Merge branch 'pw/rebase-i-error-message'
When the user adds to "git rebase -i" instruction to "pick" a merge commit, the error experience is not pleasant. Such an error is now caught earlier in the process that parses the todo list. * pw/rebase-i-error-message: rebase -i: improve error message when picking merge rebase -i: pass struct replay_opts to parse_insn_line()
This commit is contained in:
@ -206,7 +206,7 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
|
||||
return replay;
|
||||
}
|
||||
|
||||
static int edit_todo_file(unsigned flags)
|
||||
static int edit_todo_file(unsigned flags, struct replay_opts *opts)
|
||||
{
|
||||
const char *todo_file = rebase_path_todo();
|
||||
struct todo_list todo_list = TODO_LIST_INIT,
|
||||
@ -217,7 +217,8 @@ static int edit_todo_file(unsigned flags)
|
||||
return error_errno(_("could not read '%s'."), todo_file);
|
||||
|
||||
strbuf_stripspace(&todo_list.buf, comment_line_str);
|
||||
res = edit_todo_list(the_repository, &todo_list, &new_todo, NULL, NULL, flags);
|
||||
res = edit_todo_list(the_repository, opts, &todo_list, &new_todo,
|
||||
NULL, NULL, flags);
|
||||
if (!res && todo_list_write_to_file(the_repository, &new_todo, todo_file,
|
||||
NULL, NULL, -1, flags & ~(TODO_LIST_SHORTEN_IDS)))
|
||||
res = error_errno(_("could not write '%s'"), todo_file);
|
||||
@ -308,8 +309,8 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
|
||||
error(_("could not generate todo list"));
|
||||
else {
|
||||
discard_index(the_repository->index);
|
||||
if (todo_list_parse_insn_buffer(the_repository, todo_list.buf.buf,
|
||||
&todo_list))
|
||||
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,
|
||||
@ -364,9 +365,13 @@ static int run_sequencer_rebase(struct rebase_options *opts)
|
||||
replay_opts_release(&replay_opts);
|
||||
break;
|
||||
}
|
||||
case ACTION_EDIT_TODO:
|
||||
ret = edit_todo_file(flags);
|
||||
case ACTION_EDIT_TODO: {
|
||||
struct replay_opts replay_opts = get_replay_opts(opts);
|
||||
|
||||
ret = edit_todo_file(flags, &replay_opts);
|
||||
replay_opts_release(&replay_opts);
|
||||
break;
|
||||
}
|
||||
case ACTION_SHOW_CURRENT_PATCH: {
|
||||
struct child_process cmd = CHILD_PROCESS_INIT;
|
||||
|
||||
|
Reference in New Issue
Block a user