@@ -100,6 +100,9 @@ impl GitSync {
100
100
}
101
101
}
102
102
103
+ // Create a checkpoint to which we reset if something unusual happens
104
+ let mut git_reset = GitResetOnDrop :: new ( orig_head, self . verbose ) ;
105
+
103
106
// Update the last upstream SHA file. As a separate commit, since making it part of
104
107
// the merge has confused the heck out of josh in the past.
105
108
// We pass `--no-verify` to avoid running git hooks.
@@ -143,14 +146,6 @@ This updates the rust-version file to {upstream_sha}."#,
143
146
)
144
147
. context ( "cannot create preparation commit" ) ?;
145
148
146
- // Make sure that we reset either to the default HEAD, or the preparation commit, if
147
- // something bad happens
148
- let mut git_reset = if allow_noop {
149
- GitResetOnDrop :: new ( get_current_head_sha ( self . verbose ) ?, self . verbose )
150
- } else {
151
- GitResetOnDrop :: new ( orig_head, self . verbose )
152
- } ;
153
-
154
149
// Fetch given rustc commit.
155
150
run_command ( & [ "git" , "fetch" , & josh_url] , self . verbose )
156
151
. context ( "cannot fetch git state through Josh" ) ?;
@@ -219,16 +214,16 @@ After you fix the conflicts, `git add` the changes and run `git merge --continue
219
214
// Now detect if something has actually been pulled
220
215
let current_sha = get_current_head_sha ( self . verbose ) ?;
221
216
222
- // This is the easy case, no merge was performed, so we bail
223
- if current_sha == sha_pre_merge {
217
+ // This is the easy case, no merge was performed, so we bail, unless `allow_noop` is true
218
+ if current_sha == sha_pre_merge && !allow_noop {
224
219
eprintln ! ( "No merge was performed, no changes to pull were found. Rolling back." ) ;
225
220
return Err ( RustcPullError :: NothingToPull ) ;
226
221
}
227
222
228
223
// But it can be more tricky - we can have only empty merge/rollup merge commits from
229
224
// rustc, so a merge was created, but the in-tree diff can still be empty.
230
- // In that case we also bail.
231
- if self . has_empty_diff ( & sha_pre_merge) {
225
+ // In that case we also bail, unless `allow_noop` is true .
226
+ if self . has_empty_diff ( & sha_pre_merge) && !allow_noop {
232
227
eprintln ! ( "Only empty changes were pulled. Rolling back." ) ;
233
228
return Err ( RustcPullError :: NothingToPull ) ;
234
229
}
0 commit comments