git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 1, 2014, 00:56 UTC
Message-ID
<xmqq3890tcfe.fsf@gitster.dls.corp.google.com>
In-Reply-To
<5478996F.5050207@gmail.com>
Mark Levedahl <mlevedahl@gmail.com> writes:
Show 20 quoted lines
> 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.

Previous: Mark Levedahl
Message 9 of 9 in “commit: inform pre-commit if --amend is used”
  1. commit: inform pre-commit if --amend is usedØystein Walle, Nov 24, 2014
  2. Eric SunshineNov 24, 2014
  3. Jeff KingNov 25, 2014
  4. Junio C HamanoNov 25, 2014
  5. Jeff KingNov 25, 2014
  6. Mark LevedahlNov 27, 2014
  7. Jeff KingNov 28, 2014
  8. Mark LevedahlNov 28, 2014
  9. Junio C HamanoDec 1, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.