@@ -293,15 +293,6 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
293
293
& revisions , & shortrevisions ))
294
294
goto cleanup ;
295
295
296
- if (init_basic_state (& replay ,
297
- opts -> head_name ? opts -> head_name : "detached HEAD" ,
298
- opts -> onto , & opts -> orig_head -> object .oid ))
299
- goto cleanup ;
300
-
301
- if (!opts -> upstream && opts -> squash_onto )
302
- write_file (path_squash_onto (), "%s\n" ,
303
- oid_to_hex (opts -> squash_onto ));
304
-
305
296
strvec_pushl (& make_script_args , "" , revisions , NULL );
306
297
if (opts -> restrict_revision )
307
298
strvec_pushf (& make_script_args , "^%s" ,
@@ -310,21 +301,30 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
310
301
ret = sequencer_make_script (the_repository , & todo_list .buf ,
311
302
make_script_args .nr , make_script_args .v ,
312
303
flags );
313
-
314
- if (ret )
304
+ if (ret ) {
315
305
error (_ ("could not generate todo list" ));
316
- else {
317
- discard_index (the_repository -> index );
318
- if (todo_list_parse_insn_buffer (the_repository , & replay ,
319
- todo_list .buf .buf , & todo_list ))
320
- BUG ("unusable todo list" );
321
-
322
- ret = complete_action (the_repository , & replay , flags ,
323
- shortrevisions , opts -> onto_name , opts -> onto ,
324
- & opts -> orig_head -> object .oid , & opts -> exec ,
325
- opts -> autosquash , opts -> update_refs , & todo_list );
306
+ goto cleanup ;
326
307
}
327
308
309
+ if (init_basic_state (& replay ,
310
+ opts -> head_name ? opts -> head_name : "detached HEAD" ,
311
+ opts -> onto , & opts -> orig_head -> object .oid ))
312
+ goto cleanup ;
313
+
314
+ if (!opts -> upstream && opts -> squash_onto )
315
+ write_file (path_squash_onto (), "%s\n" ,
316
+ oid_to_hex (opts -> squash_onto ));
317
+
318
+ discard_index (the_repository -> index );
319
+ if (todo_list_parse_insn_buffer (the_repository , & replay ,
320
+ todo_list .buf .buf , & todo_list ))
321
+ BUG ("unusable todo list" );
322
+
323
+ ret = complete_action (the_repository , & replay , flags ,
324
+ shortrevisions , opts -> onto_name , opts -> onto ,
325
+ & opts -> orig_head -> object .oid , & opts -> exec ,
326
+ opts -> autosquash , opts -> update_refs , & todo_list );
327
+
328
328
cleanup :
329
329
replay_opts_release (& replay );
330
330
free (revisions );
0 commit comments