Handle case where merge-base finds no common commit.
This commit is contained in:
parent
74d5d3756d
commit
a065d222ff
1 changed files with 9 additions and 2 deletions
|
@ -220,7 +220,13 @@ def checkup_pushed():
|
||||||
details.to_push = 0
|
details.to_push = 0
|
||||||
details.to_pull = 0
|
details.to_pull = 0
|
||||||
else:
|
else:
|
||||||
merge_base = git_merge_base()
|
try:
|
||||||
|
merge_base = git_merge_base()
|
||||||
|
except subprocess.CalledProcessError as exc:
|
||||||
|
# This happens when the repository has been completely rewritten
|
||||||
|
# with a new root.
|
||||||
|
details.error = 'Root commit has changed'
|
||||||
|
return details
|
||||||
|
|
||||||
if my_head == merge_base:
|
if my_head == merge_base:
|
||||||
details.to_push = 0
|
details.to_push = 0
|
||||||
|
@ -232,7 +238,8 @@ def checkup_pushed():
|
||||||
details.to_push = len(git_commits_between(merge_base, my_head))
|
details.to_push = len(git_commits_between(merge_base, my_head))
|
||||||
details.to_pull = len(git_commits_between(merge_base, remote_head))
|
details.to_pull = len(git_commits_between(merge_base, remote_head))
|
||||||
|
|
||||||
details.pushed = (details.to_push, details.to_pull) == (0, 0)
|
all_pushed = (details.to_push, details.to_pull) == (0, 0)
|
||||||
|
details.pushed = all_pushed
|
||||||
return details
|
return details
|
||||||
|
|
||||||
def gitcheckup(directory, do_fetch=False, do_pull=False, do_push=False):
|
def gitcheckup(directory, do_fetch=False, do_pull=False, do_push=False):
|
||||||
|
|
Loading…
Reference in a new issue