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

Re: git hook question

From
Jeff King <peff@peff.net>
Date
Jun 1, 2026, 05:55 UTC
Message-ID
<20260601055555.GA16637@coredump.intra.peff.net>
In-Reply-To
<xmqqcxyaakpy.fsf@gitster.g>
On Mon, Jun 01, 2026 at 02:33:13PM +0900, Junio C Hamano wrote:
Show 8 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > I don't think so; the command is expected to handle (or ignore) the
> > arguments as appropriate.
> 
> We should also caution that the command is expected to handle not
> just the arguments but its standard input.  Not reading any and
> exiting may be a no-no for some hooks.

Perhaps. I think we've tried to make Git resilient to hooks which do not read all of their input (by ignoring SIGPIPE). It may be a bug for a hook to ignore stdin, but depending on what the hook is trying to do, that information might or might not be relevant.

I do think there is a gotcha for hooks that expect the stdin of their commands to be hooked up to a terminal to interact with the user.

I certainly don't have any objection to calling more of this out in the docs, though.

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 8 of 10 in “git hook question”
  1. Wesley SchwengleMay 29, 2026
  2. Jeff KingMay 29, 2026
  3. Wesley SchwengleMay 29, 2026
  4. WesleyMay 29, 2026
  5. Ben KnobleMay 29, 2026
  6. Jeff KingMay 29, 2026
  7. Junio C HamanoJun 1, 2026
  8. Jeff KingJun 1, 2026
  9. Jeff KingMay 29, 2026
  10. Adrian RatiuJun 3, 2026

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.