Re: [PATCH v2 6/7] rebase: write better reflog messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Junio C Hamano <gitster@xxxxxxxxx> 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
flaws.

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
adequate.

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
so.

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
Porcelain.

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" \
	    $onto^0

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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]