diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2022-10-12 09:35:07 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-10-17 19:55:03 (GMT) |
commit | da1d63363f13d4d65c59564c74fd8dd598b39c49 (patch) | |
tree | 29741a3e45957c2f3c7a31e7b6baf720f640ce09 /sequencer.c | |
parent | 4e5e1b4b616f0354218ff2e2ff3c71e4c730bbe1 (diff) | |
download | git-da1d63363f13d4d65c59564c74fd8dd598b39c49.zip git-da1d63363f13d4d65c59564c74fd8dd598b39c49.tar.gz git-da1d63363f13d4d65c59564c74fd8dd598b39c49.tar.bz2 |
rebase --merge: fix reflog when continuing
The reflog message for a conflict resolution committed by "rebase
--continue" looks like
rebase (continue): commit subject line
Unfortunately the reflog message each subsequent pick look like
rebase (continue) (pick): commit subject line
Fix this by setting the reflog message for "rebase --continue" in
sequencer_continue() so it does not affect subsequent commits. This
introduces a memory leak similar to the one leaking GIT_REFLOG_ACTION
in pick_commits(). Both of these will be fixed in a future series that
stops the sequencer calling setenv().
If we fail to commit the staged changes then we error out so
GIT_REFLOG_ACTION does not need to be reset in that case.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c index 61a8e00..5790b35 100644 --- a/sequencer.c +++ b/sequencer.c @@ -4785,6 +4785,8 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts) if (read_populate_opts(opts)) return -1; if (is_rebase_i(opts)) { + char *previous_reflog_action; + if ((res = read_populate_todo(r, &todo_list, opts))) goto release_todo_list; @@ -4795,10 +4797,13 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts) unlink(rebase_path_dropped()); } + previous_reflog_action = xstrdup(getenv(GIT_REFLOG_ACTION)); + setenv(GIT_REFLOG_ACTION, reflog_message(opts, "continue", NULL), 1); if (commit_staged_changes(r, opts, &todo_list)) { res = -1; goto release_todo_list; } + setenv(GIT_REFLOG_ACTION, previous_reflog_action, 1); } else if (!file_exists(get_todo_path(opts))) return continue_single_pick(r, opts); else if ((res = read_populate_todo(r, &todo_list, opts))) |