sequencer: stop exporting GIT_REFLOG_ACTION
commitd188a60d7228f051bb4004924d20d961ada636f3
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 9 Nov 2022 14:21:57 +0000 (9 14:21 +0000)
committerTaylor Blau <me@ttaylorr.com>
Wed, 9 Nov 2022 23:15:43 +0000 (9 18:15 -0500)
tree95bef8b80afea30c009330d5f1699faea03c5ef1
parent3b08839926fcc7cc48cf4c759737c1a71af430c1
sequencer: stop exporting GIT_REFLOG_ACTION

Each time it picks a commit the sequencer copies the GIT_REFLOG_ACITON
environment variable so it can temporarily change it and then restore
the previous value. This results in code that is hard to follow and also
leaks memory because (i) we fail to free the copy when we've finished
with it and (ii) each call to setenv() leaks the previous value. Instead
pass the reflog action around in a variable and use it to set
GIT_REFLOG_ACTION in the child environment when running "git commit".

Within the sequencer GIT_REFLOG_ACTION is no longer set and is only read
by sequencer_reflog_action(). It is still set by rebase before calling
the sequencer, that will be addressed in the next commit. cherry-pick
and revert are unaffected as they do not set GIT_REFLOG_ACTION before
calling the sequencer.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
sequencer.c
sequencer.h