Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin <alban.gruin@gmail.com>2019-03-05 22:18:04 +0300
committerJunio C Hamano <gitster@pobox.com>2019-03-07 03:17:57 +0300
commit1451d0f616fb1a046349cc8cd94736bcfde5e4a5 (patch)
treedd8bfb851d2066634f8e36ea0907fb28ed1150db /sequencer.c
parenta930eb03a8299b5b29284dd9e3c253c38187167a (diff)
sequencer: use edit_todo_list() in complete_action()
This changes complete_action() to use edit_todo_list(), now that it can handle the initial edit of the todo list. 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.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/sequencer.c b/sequencer.c
index 7d46f76a8b..c56c3add1a 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4746,6 +4746,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
struct todo_list new_todo = TODO_LIST_INIT;
struct strbuf *buf = &todo_list->buf;
struct object_id oid;
+ int res;
get_oid(onto, &oid);
shortonto = find_unique_abbrev(&oid, DEFAULT_ABBREV);
@@ -4770,24 +4771,16 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
return error(_("nothing to do"));
}
- if (todo_list_write_to_file(r, todo_list, todo_file,
- shortrevisions, shortonto, -1,
- flags | TODO_LIST_SHORTEN_IDS | TODO_LIST_APPEND_TODO_HELP))
- return error_errno(_("could not write '%s'"), todo_file);
-
- if (copy_file(rebase_path_todo_backup(), todo_file, 0666))
- return error(_("could not copy '%s' to '%s'."), todo_file,
- rebase_path_todo_backup());
-
- if (launch_sequence_editor(todo_file, &new_todo.buf, NULL)) {
+ res = edit_todo_list(r, todo_list, &new_todo, shortrevisions,
+ shortonto, flags);
+ if (res == -1)
+ return -1;
+ else if (res == -2) {
apply_autostash(opts);
sequencer_remove_state(opts);
return -1;
- }
-
- strbuf_stripspace(&new_todo.buf, 1);
- if (new_todo.buf.len == 0) {
+ } else if (res == -3) {
apply_autostash(opts);
sequencer_remove_state(opts);
todo_list_release(&new_todo);