@@ -45,6 +45,7 @@ impl GitSync {
4545 & self ,
4646 upstream_repo : String ,
4747 upstream_commit : Option < String > ,
48+ allow_noop : bool ,
4849 ) -> Result < PullResult , RustcPullError > {
4950 // The upstream commit that we want to pull
5051 let upstream_sha = if let Some ( sha) = upstream_commit {
@@ -215,17 +216,29 @@ After you fix the conflicts, `git add` the changes and run `git merge --continue
215216
216217 // This is the easy case, no merge was performed, so we bail
217218 if current_sha == sha_pre_merge {
218- eprintln ! (
219- "No merge was performed, no changes to pull were found. Rolling back the preparation commit."
220- ) ;
219+ if allow_noop {
220+ git_reset. disarm ( ) ;
221+ eprintln ! (
222+ "No merge was performed, no changes to pull were found. Keeping the intermediate state."
223+ ) ;
224+ } else {
225+ eprintln ! (
226+ "No merge was performed, no changes to pull were found. Rolling back the preparation commit."
227+ ) ;
228+ }
221229 return Err ( RustcPullError :: NothingToPull ) ;
222230 }
223231
224232 // But it can be more tricky - we can have only empty merge/rollup merge commits from
225233 // rustc, so a merge was created, but the in-tree diff can still be empty.
226234 // In that case we also bail.
227235 if self . has_empty_diff ( & sha_pre_merge) {
228- eprintln ! ( "Only empty changes were pulled. Rolling back the preparation commit." ) ;
236+ if allow_noop {
237+ git_reset. disarm ( ) ;
238+ eprintln ! ( "Only empty changes were pulled. Keeping the intermediate state." ) ;
239+ } else {
240+ eprintln ! ( "Only empty changes were pulled. Rolling back the preparation commit." ) ;
241+ }
229242 return Err ( RustcPullError :: NothingToPull ) ;
230243 }
231244
0 commit comments