Merge branch 'ow/rebase-verify-insn-fmt-before-initializing-state'
"git rebase -i" with bogus rebase.instructionFormat configuration failed to produce the todo file after recording the state files, leading to confused "git status"; this has been corrected. * ow/rebase-verify-insn-fmt-before-initializing-state: rebase: write script before initializing state
This commit is contained in:
@@ -293,6 +293,19 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
|
||||
&revisions, &shortrevisions))
|
||||
goto cleanup;
|
||||
|
||||
strvec_pushl(&make_script_args, "", revisions, NULL);
|
||||
if (opts->restrict_revision)
|
||||
strvec_pushf(&make_script_args, "^%s",
|
||||
oid_to_hex(&opts->restrict_revision->object.oid));
|
||||
|
||||
ret = sequencer_make_script(the_repository, &todo_list.buf,
|
||||
make_script_args.nr, make_script_args.v,
|
||||
flags);
|
||||
if (ret) {
|
||||
error(_("could not generate todo list"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (init_basic_state(&replay,
|
||||
opts->head_name ? opts->head_name : "detached HEAD",
|
||||
opts->onto, &opts->orig_head->object.oid))
|
||||
@@ -302,28 +315,15 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
|
||||
write_file(path_squash_onto(), "%s\n",
|
||||
oid_to_hex(opts->squash_onto));
|
||||
|
||||
strvec_pushl(&make_script_args, "", revisions, NULL);
|
||||
if (opts->restrict_revision)
|
||||
strvec_pushf(&make_script_args, "^%s",
|
||||
oid_to_hex(&opts->restrict_revision->object.oid));
|
||||
discard_index(the_repository->index);
|
||||
if (todo_list_parse_insn_buffer(the_repository, &replay,
|
||||
todo_list.buf.buf, &todo_list))
|
||||
BUG("unusable todo list");
|
||||
|
||||
ret = sequencer_make_script(the_repository, &todo_list.buf,
|
||||
make_script_args.nr, make_script_args.v,
|
||||
flags);
|
||||
|
||||
if (ret)
|
||||
error(_("could not generate todo list"));
|
||||
else {
|
||||
discard_index(the_repository->index);
|
||||
if (todo_list_parse_insn_buffer(the_repository, &replay,
|
||||
todo_list.buf.buf, &todo_list))
|
||||
BUG("unusable todo list");
|
||||
|
||||
ret = complete_action(the_repository, &replay, flags,
|
||||
shortrevisions, opts->onto_name, opts->onto,
|
||||
&opts->orig_head->object.oid, &opts->exec,
|
||||
opts->autosquash, opts->update_refs, &todo_list);
|
||||
}
|
||||
ret = complete_action(the_repository, &replay, flags,
|
||||
shortrevisions, opts->onto_name, opts->onto,
|
||||
&opts->orig_head->object.oid, &opts->exec,
|
||||
opts->autosquash, opts->update_refs, &todo_list);
|
||||
|
||||
cleanup:
|
||||
replay_opts_release(&replay);
|
||||
|
||||
Reference in New Issue
Block a user