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

Re: Git branch outputs usage message on stderr

From
JKJonas Konrad <jonas.konrad@uni-muenster.de>
Date
Jan 15, 2025, 14:47 UTC
Message-ID
<17c78893-d200-4646-a81b-28f32bcf958e@uni-muenster.de>
In-Reply-To
<D72M6S9O1E9F.WVEBV7ZJ1JTC@cepl.eu>

Well, let me add that one detail: I could not find any other git sub command which behaves the same (admittedly haven't tried all). Instead, the ones I have tried give their help output usually on stdout. Try yourself with `git -h`. It perfectly acts according to what I'd expect (exit status 0). Where as `git reflog -h`outputs to stdout but still exit with non-zero status (which seems okay). `git branch -h` adds a third way, as described. I argue: That diverging behavior is confusing to the user.

If your claim was right, this bug report got even bigger as a lot of behavior from other subcommands would have to be changed. In fact, what "substantial material" is, has to be defined for every piece of software regarding each output. However, I cannot see how one subcommand's usage message is considered "substantial" whereas another subcommand's usage message is not (besides, I guess, `git branch` is more frequently used than `git reflog`).

Best, Jonas

On 15.01.25 12:36, Matěj Cepl wrote:
Show 17 quoted lines
> On Wed Jan 15, 2025 at 12:22 PM CET, Jonas Konrad wrote:
>> What did you do before the bug happened? (Steps to reproduce your issue)
>> I opened a terminal on Arch Linux with a bash shell and called `git
>> branch -h` to get a usage overview of git's `branch` command. I then
>> tried processing the output with `grep` by `git branch -h | grep list`
>> which gave the whole (unfiltered) output, i.e., the displayed message
>> was not processed by `grep`.
> And that is exactly the correct behaviour. In the world of UNIX,
> where pipes are normal, utilities should send to the stdout
> only substantial material, which could be processed down the
> pipeline. Error messages, help, and similar diagnostics, should
> go to stderr. Also, you know about `|&`, right?
>
> Best,
>
> Matěj
>
Previous: Matěj CeplNext: Junio C Hamano
Message 3 of 27 in “Git branch outputs usage message on stderr”
  1. Jonas KonradJan 15, 2025
  2. Matěj CeplJan 15, 2025
  3. Jonas KonradJan 15, 2025
  4. Junio C HamanoJan 15, 2025
  5. Kristoffer HaugsbakkJan 15, 2025
  6. Jeff KingJan 15, 2025
  7. Junio C HamanoJan 15, 2025
  8. Junio C HamanoJan 15, 2025
  9. Jeff KingJan 15, 2025
  10. Junio C HamanoJan 15, 2025
  11. Jeff KingJan 15, 2025
  12. Junio C HamanoJan 15, 2025
  13. Jeff KingJan 15, 2025
  14. Junio C HamanoJan 15, 2025
  15. Junio C HamanoJan 16, 2025
  16. Jeff KingJan 16, 2025
  17. Junio C HamanoJan 15, 2025
  18. Jeff KingJan 15, 2025
  19. Junio C HamanoJan 15, 2025
  20. Junio C HamanoJan 15, 2025
  21. Kristoffer HaugsbakkJan 15, 2025
  22. Junio C HamanoJan 15, 2025
  23. Jonas KonradJan 15, 2025
  24. Kristoffer HaugsbakkJan 15, 2025
  25. Junio C HamanoJan 15, 2025
  26. Kristoffer HaugsbakkJan 15, 2025
  27. Junio C HamanoJan 15, 2025

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.