summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-04-22 20:42:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-22 20:42:51 (GMT)
commit3aa30ccb1c242bf328892e3d7ba218411aadbc6a (patch)
tree576ee78184f9ab96f1028ca2eba344675dc21168 /sequencer.c
parent3ea2b46628a6efcdc9e578dc492f0464f07d77ab (diff)
parent1f6965f994f8fe2fca80e17b5dbb293d05716be9 (diff)
downloadgit-3aa30ccb1c242bf328892e3d7ba218411aadbc6a.zip
git-3aa30ccb1c242bf328892e3d7ba218411aadbc6a.tar.gz
git-3aa30ccb1c242bf328892e3d7ba218411aadbc6a.tar.bz2
Merge branch 'en/sequencer-reflog-action'
"git rebase -i" did not leave the reflog entries correctly. * en/sequencer-reflog-action: sequencer: honor GIT_REFLOG_ACTION
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c
index 461df36..9907500 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3724,10 +3724,11 @@ static const char *reflog_message(struct replay_opts *opts,
{
va_list ap;
static struct strbuf buf = STRBUF_INIT;
+ char *reflog_action = getenv(GIT_REFLOG_ACTION);
va_start(ap, fmt);
strbuf_reset(&buf);
- strbuf_addstr(&buf, action_name(opts));
+ strbuf_addstr(&buf, reflog_action ? reflog_action : action_name(opts));
if (sub_action)
strbuf_addf(&buf, " (%s)", sub_action);
if (fmt) {
@@ -3815,8 +3816,11 @@ static int pick_commits(struct repository *r,
struct replay_opts *opts)
{
int res = 0, reschedule = 0;
+ char *prev_reflog_action;
+ /* Note that 0 for 3rd parameter of setenv means set only if not set */
setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
+ prev_reflog_action = xstrdup(getenv(GIT_REFLOG_ACTION));
if (opts->allow_ff)
assert(!(opts->signoff || opts->no_commit ||
opts->record_origin || opts->edit));
@@ -3861,12 +3865,14 @@ static int pick_commits(struct repository *r,
}
if (item->command <= TODO_SQUASH) {
if (is_rebase_i(opts))
- setenv("GIT_REFLOG_ACTION", reflog_message(opts,
+ setenv(GIT_REFLOG_ACTION, reflog_message(opts,
command_to_string(item->command), NULL),
1);
res = do_pick_commit(r, item->command, item->commit,
opts, is_final_fixup(todo_list),
&check_todo);
+ if (is_rebase_i(opts))
+ setenv(GIT_REFLOG_ACTION, prev_reflog_action, 1);
if (is_rebase_i(opts) && res < 0) {
/* Reschedule */
advise(_(rescheduled_advice),