diff options
author | Alban Gruin <alban.gruin@gmail.com> | 2019-03-05 20:17:58 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-07 01:17:57 +0100 |
commit | 1ba204de6924b171024638bb5f3f405a0e0946d0 (patch) | |
tree | 90aa5c5b4996fe59509e93e0672e0137f0efb4fb /sequencer.c | |
parent | sequencer: change complete_action() to use the refactored functions (diff) | |
download | git-1ba204de6924b171024638bb5f3f405a0e0946d0.tar.xz git-1ba204de6924b171024638bb5f3f405a0e0946d0.zip |
rebase--interactive: move sequencer_add_exec_commands()
As sequencer_add_exec_commands() is only needed inside of
rebase--interactive.c for `rebase -p', it is moved there from
sequencer.c.
The parameter r (repository) is dropped along the way.
Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/sequencer.c b/sequencer.c index 1d5cd2fc27..280d9bcce7 100644 --- a/sequencer.c +++ b/sequencer.c @@ -4500,8 +4500,8 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc, * Add commands after pick and (series of) squash/fixup commands * in the todo list. */ -static void todo_list_add_exec_commands(struct todo_list *todo_list, - struct string_list *commands) +void todo_list_add_exec_commands(struct todo_list *todo_list, + struct string_list *commands) { struct strbuf *buf = &todo_list->buf; size_t base_offset = buf->len; @@ -4567,30 +4567,6 @@ static void todo_list_add_exec_commands(struct todo_list *todo_list, todo_list->alloc = alloc; } -int sequencer_add_exec_commands(struct repository *r, - struct string_list *commands) -{ - const char *todo_file = rebase_path_todo(); - struct todo_list todo_list = TODO_LIST_INIT; - int res; - - if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0) - return error_errno(_("could not read '%s'."), todo_file); - - if (todo_list_parse_insn_buffer(r, todo_list.buf.buf, &todo_list)) { - todo_list_release(&todo_list); - return error(_("unusable todo list: '%s'"), todo_file); - } - - todo_list_add_exec_commands(&todo_list, commands); - res = todo_list_write_to_file(r, &todo_list, todo_file, NULL, NULL, -1, 0); - todo_list_release(&todo_list); - - if (res) - return error_errno(_("could not write '%s'."), todo_file); - return 0; -} - static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_list, struct strbuf *buf, int num, unsigned flags) { |