Skip to content

Commit b2d6057

Browse files
committed
outgoing check needs to take current branch into account
1 parent 07e3292 commit b2d6057

File tree

1 file changed

+11
-1
lines changed
  • tools/src/main/python/opengrok_tools/scm

1 file changed

+11
-1
lines changed

tools/src/main/python/opengrok_tools/scm/git.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,20 @@ def incoming_check(self):
5555
self._configure_git_pull()
5656
return self._run_custom_incoming_command([self.command, 'pull', '--dry-run'])
5757

58+
def get_branch(self):
59+
status, out = self._run_command([self.command, 'branch', '--show-current'])
60+
if status != 0:
61+
raise RepositoryException("cannot get branch of {}: {}".format(self, out))
62+
63+
branch = out.split('\n')[0]
64+
65+
return branch
66+
5867
def strip_outgoing(self):
5968
self._configure_git_pull()
69+
branch = self.get_branch()
6070
status, out = self._run_command([self.command, 'log',
61-
'--pretty=tformat:%H', '--reverse', 'origin..'])
71+
'--pretty=tformat:%H', '--reverse', 'origin/' + branch + '..'])
6272
if status == 0:
6373
lines = out.split('\n')
6474
if len(lines) == 0:

0 commit comments

Comments
 (0)