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

Re: Commit f5bbc322 to git broke pre-commit hooks which read stdin

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 5, 2008, 05:46 UTC
Message-ID
<20080305054646.GB8410@spearce.org>
In-Reply-To
<7vtzjl3f6d.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > What happens to such hooks under git-gui?
> >
> > git-gui invokes the pre-commit hook with stdin coming off the stdin
> > that the wish process inherited when it was spawned.  This may not
> > be the best way to interact with the end-user of that repository.
> 
> Well, if git-gui is designed to interoperate with CLI git (and I think
> that is a sensible thing to aim for), we probably should revisit the list
> of hooks in hooks.txt and make sure we define the environment these hooks
> are invoked in precisely enough (this incidentally will help C rewrite
> effort to avoid regressing).

Yup. That I think is key, because then hook authors know what they can assume, and what they cannot.

> Then, hooks that take input from and give
> output to the user could be launched with I/O redirected to talk with wish
> (which I presume has a terminal lookalike widget you can embed in your
> application).

Nope. In fact the one that I already have right now is not dealing with the \r in the progress meters from git correctly. Someone needs to revisit that code. Something's not right with it.

Oh, and the one that git-gui does have only handles output. It does not permit input. Nor does it actually honor weird stty modes like say noecho. Its most decidely *not* a tty.

-- 
Shawn.
Previous: Junio C HamanoNext: Jakub Narebski
Message 12 of 14 in “Bug#469250: Commit f5bbc322 to git broke pre-commit hooks which read stdin”
  1. David BremnerMar 4, 2008
  2. Johannes SchindelinMar 4, 2008
  3. Junio C HamanoMar 4, 2008
  4. Johannes SixtMar 4, 2008
  5. Junio C HamanoMar 4, 2008
  6. David BremnerMar 4, 2008
  7. Johannes SchindelinMar 4, 2008
  8. Joey HessMar 4, 2008
  9. David BremnerMar 4, 2008
  10. Shawn O. PearceMar 5, 2008
  11. Junio C HamanoMar 5, 2008
  12. Shawn O. PearceMar 5, 2008
  13. Jakub NarebskiMar 4, 2008
  14. Johannes SchindelinMar 4, 2008

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.