rebase -i: pass struct replay_opts to parse_insn_line()
This new parameter will be used in the next commit. As adding the parameter requires quite a few changes to plumb it through the call chain these are separated into their own commit to avoid cluttering up the next commit with incidental changes. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
19981daefd
commit
0c26738aa4
@ -101,9 +101,10 @@ void append_todo_help(int command_count,
|
||||
strbuf_add_commented_lines(buf, msg, strlen(msg), comment_line_str);
|
||||
}
|
||||
|
||||
int edit_todo_list(struct repository *r, struct todo_list *todo_list,
|
||||
struct todo_list *new_todo, const char *shortrevisions,
|
||||
const char *shortonto, unsigned flags)
|
||||
int edit_todo_list(struct repository *r, struct replay_opts *opts,
|
||||
struct todo_list *todo_list, struct todo_list *new_todo,
|
||||
const char *shortrevisions, const char *shortonto,
|
||||
unsigned flags)
|
||||
{
|
||||
const char *todo_file = rebase_path_todo(),
|
||||
*todo_backup = rebase_path_todo_backup();
|
||||
@ -114,7 +115,9 @@ int edit_todo_list(struct repository *r, struct todo_list *todo_list,
|
||||
* it. If there is an error, we do not return, because the user
|
||||
* might want to fix it in the first place. */
|
||||
if (!initial)
|
||||
incorrect = todo_list_parse_insn_buffer(r, todo_list->buf.buf, todo_list) |
|
||||
incorrect = todo_list_parse_insn_buffer(r, opts,
|
||||
todo_list->buf.buf,
|
||||
todo_list) |
|
||||
file_exists(rebase_path_dropped());
|
||||
|
||||
if (todo_list_write_to_file(r, todo_list, todo_file, shortrevisions, shortonto,
|
||||
@ -134,13 +137,13 @@ int edit_todo_list(struct repository *r, struct todo_list *todo_list,
|
||||
if (initial && new_todo->buf.len == 0)
|
||||
return -3;
|
||||
|
||||
if (todo_list_parse_insn_buffer(r, new_todo->buf.buf, new_todo)) {
|
||||
if (todo_list_parse_insn_buffer(r, opts, new_todo->buf.buf, new_todo)) {
|
||||
fprintf(stderr, _(edit_todo_list_advice));
|
||||
return -4;
|
||||
}
|
||||
|
||||
if (incorrect) {
|
||||
if (todo_list_check_against_backup(r, new_todo)) {
|
||||
if (todo_list_check_against_backup(r, opts, new_todo)) {
|
||||
write_file(rebase_path_dropped(), "%s", "");
|
||||
return -4;
|
||||
}
|
||||
@ -228,13 +231,15 @@ leave_check:
|
||||
return res;
|
||||
}
|
||||
|
||||
int todo_list_check_against_backup(struct repository *r, struct todo_list *todo_list)
|
||||
int todo_list_check_against_backup(struct repository *r,
|
||||
struct replay_opts *opts,
|
||||
struct todo_list *todo_list)
|
||||
{
|
||||
struct todo_list backup = TODO_LIST_INIT;
|
||||
int res = 0;
|
||||
|
||||
if (strbuf_read_file(&backup.buf, rebase_path_todo_backup(), 0) > 0) {
|
||||
todo_list_parse_insn_buffer(r, backup.buf.buf, &backup);
|
||||
todo_list_parse_insn_buffer(r, opts, backup.buf.buf, &backup);
|
||||
res = todo_list_check(&backup, todo_list);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user