Skip to content

Commit 673b41a

Browse files
committed
fix normal case
1 parent d52c09a commit 673b41a

File tree

1 file changed

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

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@ def strip_outgoing(self):
6060
status, out = self._run_command([self.command, 'log',
6161
'--pretty=tformat:%H', '--reverse', 'origin..'])
6262
if status == 0:
63-
cset = out.get(0)
64-
if cset:
65-
self.logger.debug("Resetting the repository {} to parent of changeset {}".
63+
lines = out.split('\n')
64+
if len(lines) == 0:
65+
return False
66+
67+
cset = lines[0]
68+
if len(cset) > 0:
69+
self.logger.debug("Resetting the repository {} to parent of changeset '{}'".
6670
format(self, cset))
6771
status, out = self._run_command([self.command, 'reset', '--hard',
6872
cset + '^'])
@@ -71,8 +75,8 @@ def strip_outgoing(self):
7175
format(self, cset, out))
7276
else:
7377
return True
74-
else:
75-
return False
78+
else:
79+
raise RepositoryException("failed to check for outgoing changes in {}: {}".
80+
format(self, status))
7681

77-
raise RepositoryException("failed to check for outgoing changes in {}: {}".
78-
format(self, status))
82+
return False

0 commit comments

Comments
 (0)