summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-04-22 18:35:41 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-04-22 18:35:41 -0400
commit444f0564fbe0d25f5cad52cb6899b2c2ad9f1cf7 (patch)
tree0f6557c2275ffc23fef073ad0976a791a5b4e4b7
parentcbcc79012d44e6b7e79583d078409628b8834a69 (diff)
downloadb4-444f0564fbe0d25f5cad52cb6899b2c2ad9f1cf7.tar.gz
Properly deal with merge to non-current branch
When running rev-list, be mindful of which branch we need to operate on, otherwise it always runs on the current branch. Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ty.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/b4/ty.py b/b4/ty.py
index 008da09..8c61cd2 100644
--- a/b4/ty.py
+++ b/b4/ty.py
@@ -51,9 +51,11 @@ MY_COMMITS = None
BRANCH_INFO = None
-def git_get_merge_id(gitdir, commit_id):
+def git_get_merge_id(gitdir, commit_id, branch=None):
# get merge commit id
args = ['rev-list', '%s..' % commit_id, '--ancestry-path']
+ if branch is not None:
+ args += [branch]
lines = b4.git_get_command_lines(gitdir, args)
if not len(lines):
return None
@@ -117,7 +119,7 @@ def auto_locate_pr(gitdir, jsondata, branch):
return None
# Get the merge commit
- merge_commit_id = git_get_merge_id(gitdir, pr_commit_id)
+ merge_commit_id = git_get_merge_id(gitdir, pr_commit_id, branch)
if not merge_commit_id:
logger.debug('Could not get a merge commit-id for %s', pr_commit_id)
return None