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

Re: [PATCH v4 15/16] branch: use ref-filter printing APIs

From
Karthik Nayak <karthik.188@gmail.com>
Date
Apr 14, 2016, 19:17 UTC
Message-ID
<CAOLa=ZR7rKETM2b34B2Whw7Au-t7iFEkcNAB4ZygeQM=9Lp9zQ@mail.gmail.com>
In-Reply-To
<20160413220559.GC8712@sigill.intra.peff.net>
On Thu, Apr 14, 2016 at 3:35 AM, Jeff King <peff@peff.net> wrote:
Show 10 quoted lines
>
> The cross-prefix behavior I put into the test is not something I feel
> strongly about; it was mostly just restoring the earlier behavior. I do
> think shortening everything is fine, too, as long as there's some way to
> get the fully qualified ref. E.g., if `git branch` shows %(symref:short)
> or %(symref:strip=2), by default, but you can ask for just %(symref) if
> you want (which I think is how you have it implemented now, though I
> notice that symrefs don't get nearly as many formatting options as
> things like %(upstream)).
>

That does make sense, I guess then I'll stick to shortening all symref's by default and allowing the user to change this if needed via the '--format' option.

About %(symref) not getting enough formatting options, I don't see anything else in %(upstream) which would be required in %(symref), maybe the 'strip=X' option could be added. But for now I see 'short' to be the only needed option. If anyone feels that something else would be useful, I'd be glad to add it along.

Show 6 quoted lines
> If anyone is machine-parsing git-branch output in the first place, they
> are Doing It Wrong. And doubly so if they are relying on some obscure
> shortening rules that I don't think were ever carefully designed. So I
> think we should be free to change it here to what serves users best.
>
> -Peff

This is a good reason, since 'git branch' is a porcelain command a change like this shouldn't be a problem.

Junio, I'll re-roll with a small fix to the test written by Jeff soon.
-- 
Regards,
Karthik Nayak
Previous: Jeff KingNext: Jeff King
Message 27 of 31 in “port branch.c to use ref-filter's printing options”
  1. 00/16 port branch.c to use ref-filter's printing optionsKarthik Nayak, Apr 9, 2016
  2. 01/16 ref-filter: implement %(if), %(then), and %(else) atomsKarthik Nayak, Apr 9, 2016
  3. 02/16 ref-filter: include reference to 'used_atom' within 'atom_value'Karthik Nayak, Apr 9, 2016
  4. 03/16 ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)Karthik Nayak, Apr 9, 2016
  5. 04/16 ref-filter: modify "%(objectname:short)" to take lengthKarthik Nayak, Apr 9, 2016
  6. 05/16 ref-filter: move get_head_description() from branch.cKarthik Nayak, Apr 9, 2016
  7. 06/16 ref-filter: introduce format_ref_array_item()Karthik Nayak, Apr 9, 2016
  8. 07/16 ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreamsKarthik Nayak, Apr 9, 2016
  9. 08/16 ref-filter: add support for %(upstream:track,nobracket)Karthik Nayak, Apr 9, 2016
  10. 09/16 ref-filter: make "%(symref)" atom work with the ':short' modifierKarthik Nayak, Apr 9, 2016
  11. 10/16 ref-filter: introduce symref_atom_parser()Karthik Nayak, Apr 9, 2016
  12. 11/16 ref-filter: introduce refname_atom_parser()Karthik Nayak, Apr 9, 2016
  13. Jeff KingApr 14, 2016
  14. Karthik NayakApr 15, 2016
  15. 12/16 ref-filter: add support for %(refname:dir) and %(refname:base)Karthik Nayak, Apr 9, 2016
  16. 13/16 ref-filter: allow porcelain to translate messages in the outputKarthik Nayak, Apr 9, 2016
  17. 14/16 branch, tag: use porcelain outputKarthik Nayak, Apr 9, 2016
  18. 15/16 branch: use ref-filter printing APIsKarthik Nayak, Apr 9, 2016
  19. Junio C HamanoApr 12, 2016
  20. Junio C HamanoApr 12, 2016
  21. Karthik NayakApr 13, 2016
  22. Stefan BellerApr 16, 2016
  23. Karthik NayakApr 17, 2016
  24. 16/16 branch: implement '--format' optionKarthik Nayak, Apr 9, 2016
  25. Karthik NayakApr 13, 2016
  26. Jeff KingApr 13, 2016
  27. Karthik NayakApr 14, 2016
  28. Jeff KingApr 14, 2016
  29. Jeff KingApr 14, 2016
  30. Karthik NayakApr 15, 2016
  31. Jeff KingApr 15, 2016

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.