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

Re: [PATCH 0/7] [RFC] advice: refuse to output if stderr not TTY

From
Jeff King <peff@peff.net>
Date
Aug 21, 2024, 15:40 UTC
Message-ID
<20240821154001.GA506216@coredump.intra.peff.net>
In-Reply-To
<pull.1776.git.1724238152.gitgitgadget@gmail.com>
On Wed, Aug 21, 2024 at 11:02:25AM +0000, Derrick Stolee via GitGitGadget wrote:
Show 8 quoted lines
> Advice is supposed to be for humans, not machines. Why do we output it when
> stderr is not a terminal? Let's stop doing that.
> 
> I'm labeling this as an RFC because I believe there is some risk with this
> change. In particular, this does change behavior to reduce the output that
> some scripts may depend upon. But this output is not intended to be locked
> in and we add or edit advice messages without considering this impact, so
> there is risk in the existing system already.

Playing devil's advocate for a moment: what about programs that read stderr but intend to relay the output to the user?

For example, programs running on the server side of a push are spawned by receive-pack with their stderr fed into a muxer that ships it to the client, who then dumps it to the user's terminal. Would we ever want to see their advice?

My guess is "conceivably yes", though I don't know of a specific example (and in fact, I've seen the "your hook was ignored because it's not executable" advice coming from a server, which was actually more of an annoyance on the client side).

Ditto for upload-pack. Another possible place where it matters: interfaces that wrap Git and collect the output to show to the user. I don't use git-gui, but I'd imagine it does this in some places.

Looking over patch 7, I think the escape hatch for all of these cases would be setting GIT_ADVICE=1. Which isn't too bad, but it does require some action. I'm not sure if it is worth it (but then, I am not all that sympathetic to the script you mentioned that was trying to be too clever about parsing stderr).

-Peff
Previous: Derrick Stolee via GitGitGadgetNext: Junio C Hamano
Message 9 of 15 in “[RFC] advice: refuse to output if stderr not TTY”
  1. 0/7 [RFC] advice: refuse to output if stderr not TTYDerrick Stolee via GitGitGadget, Aug 21, 2024
  2. 1/7 t1000-2000: add GIT_ADVICE=1 for advice testsDerrick Stolee via GitGitGadget, Aug 21, 2024
  3. 2/7 t3000-4000: add GIT_ADVICE=1 to advice testsDerrick Stolee via GitGitGadget, Aug 21, 2024
  4. 3/7 t5000: add GIT_ADVICE=1 to advice testsDerrick Stolee via GitGitGadget, Aug 21, 2024
  5. 4/7 t6000: add GIT_ADVICE=1 to advice testsDerrick Stolee via GitGitGadget, Aug 21, 2024
  6. 5/7 t7000: add GIT_ADVICE=1 to advice testsDerrick Stolee via GitGitGadget, Aug 21, 2024
  7. 6/7 t7508/12: set GIT_ADVICE=1 across all testsDerrick Stolee via GitGitGadget, Aug 21, 2024
  8. 7/7 advice: refuse to output if stderr not TTYDerrick Stolee via GitGitGadget, Aug 21, 2024
  9. Jeff KingAug 21, 2024
  10. Junio C HamanoAug 21, 2024
  11. Junio C HamanoAug 21, 2024
  12. Patrick SteinhardtAug 22, 2024
  13. Gabor GombasAug 22, 2024
  14. Derrick StoleeAug 22, 2024
  15. Junio C HamanoAug 22, 2024

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.