Junio C Hamano <gits...@pobox.com> writes:

> Junio C Hamano <gits...@pobox.com> writes:
>> Excellent question, and I think this illustrates why the recent
>> reroll that uses an approach to use base_reflog_action is not
>> complete and needs further work (to put it mildly).
>> ...
>> That essentially boils down to the very original suggestion I made
>> before Ram introduced the base_reflog_action.
> So how about doing something like this?

Having said all that, although I think the "something like this"
patch is an improvement in that it spells out the rules regarding
the use of GIT_REFLOG_ACTION environment variable, which was not
documented so far, I think the environment variable is showing its

It was a good mechanism in simpler times, back when "git commit",
"git fetch" and "git merge" were its primary users.  They didn't do
many ref updates, and having a way to record that "this update was
done by a 'merge' command initiated by the end user" was perfectly

For a command like "rebase" that can do many ref updates, having to
set a custom message and export the variable in each and every step
is cumbersome, and keeping the same prefix across becomes even more

The $orig_reflog_action used inside git-rebase--interactive is a
reasonable local solution for the "keeping the same prefix" problem,
but it is a _local_ solution that does not scale.  In the end, it
updates the GIT_REFLOG_ACTION variable, so the script has to be very
careful to make sure the variable has a sensible value before
calling any ref-updating "git" command.  It will have to set it back
to $orig_reflog_action if it ever wants to call another scripted

Among the C infrastructure, commit, fetch, merge and reset are the
only ones that pay attention to GIT_REFLOG_ACTION, and we will be
adding checkout to the mix.  If we originally did not make the
mistake of using GIT_REFLOG_ACTION as a whole message, and instead
used it to convey _only_ the prefix (i.e. "rebase", "am", etc.) to
subprocesses in order to remember what the end-user initiated
command was, and used a command line argument to give the actual
messages, we would have been in much better shape.  E.g. a
"checkout" call inside "git rebase" may become

        git checkout \
            --reflog-message="$GIT_REFLOG_ACTION: detaching" \

and nobody other than set_reflog_action shell function would be
setting GIT_REFLOG_ACTION variable.

Oh well.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to