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

Re: [PATCH 9/9] for-each-ref: support %(...:aligned) for left alignment

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
May 19, 2013, 11:32 UTC
Message-ID
<CALkWK0md-p25EkyyAjGE3_Ygq-4rEqQ6saG3dDq--FGRqGbF6Q@mail.gmail.com>
In-Reply-To
<1368959235-27777-10-git-send-email-pclouds@gmail.com>

I don't think [7/9] and [8/9] belong in this series. Let's see how you've used it in :aligned.

Nguyễn Thái Ngọc Duy wrote:
Show 16 quoted lines
> diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
> index 1390da8..3240ca0 100644
> --- a/builtin/for-each-ref.c
> +++ b/builtin/for-each-ref.c
> @@ -1012,8 +1013,26 @@ static void show_refs(struct refinfo **refs, int maxcount,
>                                 emit(sb + i, cp, sp);
>                 }
>                 atom = parse_atom(sp + 2, ep);
> -               for (i = 0; i < maxcount; i++)
> +               aligned = !suffixcmp(used_atom[atom], ":aligned");
> +               for (i = 0, max_length = 0; aligned && i < maxcount; i++) {
> +                       struct atom_value *v;
> +                       get_value(refs[i], atom, &v);
> +                       len = utf8_strnwidth(v->s, -1, 1);
> +                       if (len > max_length)
> +                               max_length = len;

Why?! Why are you denying me the pleasure of using %<, %<|, %>, %>|, %>>, %>>|, %<>, and %<>| that you invented in pretty? The code is already there: you just have to hook it up.

Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 22 of 31 in “for-each-ref format improvements”
  1. 0/9 for-each-ref format improvementsNguyễn Thái Ngọc Duy, May 19, 2013
  2. 1/9 quote.c: make sq_quote_print a slight wrapper of sq_quote_bufNguyễn Thái Ngọc Duy, May 19, 2013
  3. Felipe ContrerasMay 19, 2013
  4. 2/9 for-each-ref: convert to use *_quote_buf instead of _quote_printNguyễn Thái Ngọc Duy, May 19, 2013
  5. Felipe ContrerasMay 19, 2013
  6. 3/9 for-each-ref: avoid printing each element directly to stdoutNguyễn Thái Ngọc Duy, May 19, 2013
  7. Ramkumar RamachandraMay 19, 2013
  8. Duy NguyenMay 19, 2013
  9. 4/9 for-each-ref: add %(current) for current branch markerNguyễn Thái Ngọc Duy, May 19, 2013
  10. Ramkumar RamachandraMay 19, 2013
  11. 5/9 for-each-ref: add %(tracking[:upstream]) for tracking infoNguyễn Thái Ngọc Duy, May 19, 2013
  12. Ramkumar RamachandraMay 19, 2013
  13. Felipe ContrerasMay 19, 2013
  14. Duy NguyenMay 19, 2013
  15. Ramkumar RamachandraMay 19, 2013
  16. Felipe ContrerasMay 19, 2013
  17. 6/9 for-each-ref: add %(color:...)Nguyễn Thái Ngọc Duy, May 19, 2013
  18. Ramkumar RamachandraMay 19, 2013
  19. 7/9 for-each-ref: prepoplulate all atoms before show_ref()Nguyễn Thái Ngọc Duy, May 19, 2013
  20. 8/9 for-each-ref: merge show_ref into show_refsNguyễn Thái Ngọc Duy, May 19, 2013
  21. 9/9 for-each-ref: support %(...:aligned) for left alignmentNguyễn Thái Ngọc Duy, May 19, 2013
  22. Ramkumar RamachandraMay 19, 2013
  23. Duy NguyenMay 19, 2013
  24. Ramkumar RamachandraMay 19, 2013
  25. Felipe ContrerasMay 19, 2013
  26. Duy NguyenMay 19, 2013
  27. Ramkumar RamachandraMay 19, 2013
  28. Duy NguyenMay 19, 2013
  29. Ramkumar RamachandraMay 19, 2013
  30. Junio C HamanoMay 20, 2013
  31. Junio C HamanoMay 21, 2013

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.