@@ -95,7 +95,7 @@ def main():
95
95
with open (dirname + "/trusted-keys" , "r" , encoding = "utf8" ) as f :
96
96
trusted_keys = f .read ().splitlines ()
97
97
98
- # Set commit and branch and set variables
98
+ # Set commit and variables
99
99
current_commit = args .commit
100
100
if ' ' in current_commit :
101
101
print ("Commit must not contain spaces" , file = sys .stderr )
@@ -104,7 +104,6 @@ def main():
104
104
no_sha1 = True
105
105
prev_commit = ""
106
106
initial_commit = current_commit
107
- branch = subprocess .check_output ([GIT , 'show' , '-s' , '--format=%H' , initial_commit ]).decode ('utf8' ).splitlines ()[0 ]
108
107
109
108
# Iterate through commits
110
109
while True :
@@ -164,15 +163,11 @@ def main():
164
163
allow_unclean = current_commit in unclean_merge_allowed
165
164
if len (parents ) == 2 and check_merge and not allow_unclean :
166
165
current_tree = subprocess .check_output ([GIT , 'show' , '--format=%T' , current_commit ]).decode ('utf8' ).splitlines ()[0 ]
167
- subprocess .call ([GIT , 'checkout' , '--force' , '--quiet' , parents [0 ]])
168
- subprocess .call ([GIT , 'merge' , '--no-ff' , '--quiet' , '--no-gpg-sign' , parents [1 ]], stdout = subprocess .DEVNULL )
169
- recreated_tree = subprocess .check_output ([GIT , 'show' , '--format=format:%T' , 'HEAD' ]).decode ('utf8' ).splitlines ()[0 ]
166
+ recreated_tree = subprocess .check_output ([GIT , "merge-tree" , parents [0 ], parents [1 ]]).decode ('utf8' ).splitlines ()[0 ]
170
167
if current_tree != recreated_tree :
171
168
print ("Merge commit {} is not clean" .format (current_commit ), file = sys .stderr )
172
- subprocess .call ([GIT , 'diff' , current_commit ])
173
- subprocess .call ([GIT , 'checkout' , '--force' , '--quiet' , branch ])
169
+ subprocess .call ([GIT , 'diff' , recreated_tree , current_tree ])
174
170
sys .exit (1 )
175
- subprocess .call ([GIT , 'checkout' , '--force' , '--quiet' , branch ])
176
171
177
172
prev_commit = current_commit
178
173
current_commit = parents [0 ]
0 commit comments