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

Re: [PATCH 2/2] branch, for-each-ref: add option to omit empty lines

From
Jeff King <peff@peff.net>
Date
Apr 10, 2023, 19:56 UTC
Message-ID
<20230410195644.GA104097@coredump.intra.peff.net>
In-Reply-To
<xmqqo7o0q3e4.fsf@gitster.g>
On Thu, Apr 06, 2023 at 11:20:03AM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > It might be enough to flip the default unconditionally (no config), but
> > I think we may still want "--no-omit-empty-lines" as an escape hatch. I
> > dunno. Maybe that is somehow choosing the worst of both worlds.
> 
> It is very tempting, indeed.  We can add the escape hatch and flip
> the default, and only when somebody complains, come back and say
> "oh, sorry, we didn't know anybody used it" and flip the default
> back, perhaps?

I don't think flipping back after such an incident is a good idea, as it just creates more confusion. But if the option exists, then at least you can say "oh, sorry; you can still do what you want by passing this option", rather than "oh, sorry; there's no way to get what you want".

But either way, the first step before flipping any defaults is adding an option, which is what this patch is doing, so I am all for it. :)

Show 14 quoted lines
> This is a totally unrelated tangent, but it is a bit unfortunate
> that with our parse-options API, it is not trivial to
> 
>  - mark that "--keep-empty-lines" and "--omit-empty-lines" toggle
>    the same underlying Boolean variable,
> 
>  - accept "--no-keep" and "--no-omit" as obvious synonyms for
>    "--omit" and "--keep", 
> 
>  - have "git foo -h" listing to show "--keep" and "--omit" together,
> 
>  - omit these "--no-foo" variants from "git foo -h" listing.
> 
> by the way.

Yeah, "--no-" is special in our parser in a way that "--keep" and "--omit" aren't. It might be possible to make this pattern easier to support. OTOH, perhaps it is a sign that we are straying too far from existing patterns. It is not just parse-options.c, but also users themselves, who benefit from consistency.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 29 of 30 in “branch, for-each-ref: add option to omit empty lines”
  1. 0/2 branch, for-each-ref: add option to omit empty linesØystein Walle, Mar 30, 2023
  2. 1/2 ref-filter: remove unused ref_format memberØystein Walle, Mar 30, 2023
  3. Junio C HamanoMar 30, 2023
  4. Junio C HamanoMar 30, 2023
  5. Øystein WalleMar 31, 2023
  6. ZheNing HuMar 31, 2023
  7. Junio C HamanoMar 31, 2023
  8. 0/2 branch, for-each-ref: add option to omit empty linesØystein Walle, Apr 6, 2023
  9. 1/2 ref-filter: remove unused ref_format memberØystein Walle, Apr 6, 2023
  10. 2/2 branch, for-each-ref: add option to omit empty linesØystein Walle, Apr 6, 2023
  11. Junio C HamanoApr 6, 2023
  12. branch, for-each-ref, tag: add option to omit empty linesØystein Walle, Apr 7, 2023
  13. Junio C HamanoApr 7, 2023
  14. Andrei RybakApr 12, 2023
  15. Øystein WalleApr 13, 2023
  16. Junio C HamanoApr 13, 2023
  17. 2/2 branch, for-each-ref: add option to omit empty linesØystein Walle, Mar 30, 2023
  18. Junio C HamanoMar 30, 2023
  19. Jeff KingMar 30, 2023
  20. Junio C HamanoMar 30, 2023
  21. Øystein WalleMar 31, 2023
  22. Junio C HamanoMar 31, 2023
  23. Junio C HamanoMar 30, 2023
  24. Phillip WoodMar 31, 2023
  25. Junio C HamanoMar 31, 2023
  26. Øystein WalleApr 6, 2023
  27. Jeff KingApr 6, 2023
  28. Junio C HamanoApr 6, 2023
  29. Jeff KingApr 10, 2023
  30. Junio C HamanoApr 6, 2023

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.