Skip to content

Commit

Permalink
[contrib] gh-merge: Move second sha512 check to before signing
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Mar 3, 2017
1 parent 65d90f5 commit fa7da3f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions contrib/devtools/github-merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ def main():
except subprocess.CalledProcessError as e:
printf("ERROR: Cannot update message.",file=stderr)
exit(4)
second_sha512 = tree_sha512sum()
if first_sha512 != second_sha512:
print("ERROR: Tree hash changed unexpectedly",file=stderr)
exit(4)

print('%s#%s%s %s %sinto %s%s' % (ATTR_RESET+ATTR_PR,pull,ATTR_RESET,title,ATTR_RESET+ATTR_PR,branch,ATTR_RESET))
subprocess.check_call([GIT,'log','--graph','--topo-order','--pretty=format:'+COMMIT_FORMAT,base_branch+'..'+head_branch])
Expand Down Expand Up @@ -258,6 +254,11 @@ def main():
print("ERROR: Merge rejected.",file=stderr)
exit(7)

second_sha512 = tree_sha512sum()
if first_sha512 != second_sha512:
print("ERROR: Tree hash changed unexpectedly",file=stderr)
exit(8)

# Sign the merge commit.
reply = ask_prompt("Type 's' to sign off on the merge.")
if reply == 's':
Expand Down

0 comments on commit fa7da3f

Please sign in to comment.