Subject: Re: [PATCH] commit: inform pre-commit if --amend is used

From: Junio C Hamano <[email-masked]>
Date: Sun, 30 Nov 2014 16:56:53 -0800

Mark Levedahl <[email-masked]> writes:

> On 11/28/2014 12:18 AM, Jeff King wrote:
>
>> Thanks for the links; I had no recollection of that thread.
>> Unsurprisingly, I like the "HEAD"/"HEAD~1" suggestion. That "peff" guy
>> seems really clever (and handsome, too, I'll bet).
>>
>> I'd still be OK with any of the suggestions given in this thread,
>> though.
>>
>> -Peff
>> ars
>
> Apparently our combined handsome-foo was insufficient to get this
> accepted way back when, hopefully the current submitter has more :^)
>
> In any event, I've carried the patches using HEAD/HEAD~1 in my tree
> for the last 4+ years, have a widely used pre-commit script that
> depends upon those. So, I personally would be very happy to see this
> finally show up in Junio's tree, would prefer HEAD/HEAD~1 but can
> adapt to whatever.

One thing to be careful about is that the approach HEAD, HEAD~,
etc. does allow this to be extended to cover merge cases as the old
thread speculated, it will make it impossible to pass any kind of
information, other than "here are the parents of the results", to
the hook.

Of course, there are ways to make sure that we won't paint us into
an unescapable corner, e.g. an obvious example (not necessarily the
best) being to pass "HEAD", "HEAD~", "b76b088 b260d26" etc., in
other words, passing these parents still as a single argument,
multiple parents concatenated with some delimiters, so that "$1"
will always be "who are the parent(s)" even when we needed to later
pass other sorts of information.