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

Re: [PATCH v15 05/13] ref-filter: implement an `align` atom

From
Karthik Nayak <karthik.188@gmail.com>
Date
Sep 3, 2015, 16:01 UTC
Message-ID
<CAOLa=ZT=VEHWokfdBdRPsNj8VgBkyvV7GdacPaRgnMZOQ-G4qg@mail.gmail.com>
In-Reply-To
<CAPig+cRfYow-wBvorX44E4ROH=nvQdS=3zBaEVVbQZf86JFELw@mail.gmail.com>
On Thu, Sep 3, 2015 at 7:42 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 7 quoted lines
> On Tue, Sep 1, 2015 at 2:26 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
>> Implement an `align` atom which left-, middle-, or right-aligns the
>> content between %(align:..) and %(end).
>
> Spell this either %(align:) or %(align:...) with three dots, not two.
> I, personally, think %(align:) is sufficient.
>
Will change.
Show 17 quoted lines
>> It is followed by `:<width>,<position>`, where the `<position>` is
>> either left, right or middle and `<width>` is the size of the area
>> into which the content will be placed. If the content between
>> %(align:) and %(end) is more than the width then no alignment is
>> performed. e.g. to align a refname atom to the middle with a total
>> width of 40 we can do: --format="%(align:middle,40)%(refname)%(end)".
>>
>> We have an `at_end` function for each element of the stack which is to
>> be called when the `end` atom is encountered. Using this we implement
>> the aling_handler() for the `align` atom, this aligns the final strbuf
>> by calling `strbuf_utf8_align()` from utf8.c.
>>
>> Ensure that quote formatting is performed on the whole of
>> %(align)...%(end) rather than individual atoms inside.  We skip quote
>
> Add colon: %(align:)
>
Okay.
Show 5 quoted lines
>> formatting for individual atoms when the current stack element is
>> handling an %(align) atom and perform quote formatting at the end when
>
> %(align:)
>
will do.
Show 19 quoted lines
>> we encounter the %(end) atom.
>>
>> Add documentation and tests for the same.
>>
>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
>> ---
>> diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
>> index e49d578..cac3128 100644
>> --- a/Documentation/git-for-each-ref.txt
>> +++ b/Documentation/git-for-each-ref.txt
>> @@ -127,6 +127,15 @@ color::
>>         Change output color.  Followed by `:<colorname>`, where names
>>         are described in `color.branch.*`.
>>
>> +align::
>> +       Left-, middle-, or right-align the content between %(align:..)
>
> %(align:)
>
noted.
Show 10 quoted lines
>> +       and %(end). Followed by `:<width>,<position>`, where the
>> +       `<position>` is either left, right or middle and `<width>` is
>> +       the total length of the content with alignment. If the
>> +       contents length is more than the width then no alignment is
>> +       performed. If used with '--quote' everything in between
>> +       %(align:..)  and %(end) is quoted.
>
> %(align:)
> Also drop the extra space before "and": s/\s+and/ and/
>
Noted, thanks for the review.
-- 
Regards,
Karthik Nayak
Previous: Eric SunshineNext: Junio C Hamano
Message 23 of 58 in “port builtin/tag.c to use ref-filter APIs.”
  1. 00/13 port builtin/tag.c to use ref-filter APIs.Karthik Nayak, Sep 1, 2015
  2. 01/13 ref-filter: move `struct atom_value` to ref-filter.cKarthik Nayak, Sep 1, 2015
  3. 02/13 ref-filter: introduce ref_formatting_state and ref_formatting_stackKarthik Nayak, Sep 1, 2015
  4. 03/13 utf8: add function to align a string into given strbufKarthik Nayak, Sep 1, 2015
  5. 04/13 ref-filter: introduce handler function for each atomKarthik Nayak, Sep 1, 2015
  6. 05/13 ref-filter: implement an `align` atomKarthik Nayak, Sep 1, 2015
  7. Junio C HamanoSep 1, 2015
  8. Karthik NayakSep 2, 2015
  9. Junio C HamanoSep 2, 2015
  10. Karthik NayakSep 2, 2015
  11. Junio C HamanoSep 2, 2015
  12. Karthik NayakSep 2, 2015
  13. Matthieu MoySep 2, 2015
  14. Junio C HamanoSep 2, 2015
  15. Karthik NayakSep 3, 2015
  16. Matthieu MoySep 2, 2015
  17. Matthieu MoySep 2, 2015
  18. Karthik NayakSep 2, 2015
  19. Matthieu MoySep 2, 2015
  20. Karthik NayakSep 2, 2015
  21. Matthieu MoySep 2, 2015
  22. Eric SunshineSep 3, 2015
  23. Karthik NayakSep 3, 2015
  24. Junio C HamanoSep 3, 2015
  25. Karthik NayakSep 4, 2015
  26. 06/13 ref-filter: add option to filter out tags, branches and remotesKarthik Nayak, Sep 1, 2015
  27. Junio C HamanoSep 1, 2015
  28. Karthik NayakSep 2, 2015
  29. Junio C HamanoSep 2, 2015
  30. Karthik NayakSep 2, 2015
  31. 07/13 ref-filter: add support for %(contents:lines=X)Karthik Nayak, Sep 1, 2015
  32. Matthieu MoySep 2, 2015
  33. Karthik NayakSep 2, 2015
  34. Matthieu MoySep 2, 2015
  35. Karthik NayakSep 3, 2015
  36. Karthik NayakSep 3, 2015
  37. Matthieu MoySep 3, 2015
  38. Karthik NayakSep 3, 2015
  39. Eric SunshineSep 3, 2015
  40. Eric SunshineSep 3, 2015
  41. Matthieu MoySep 3, 2015
  42. Karthik NayakSep 3, 2015
  43. Junio C HamanoSep 3, 2015
  44. Karthik NayakSep 4, 2015
  45. Matthieu MoySep 3, 2015
  46. Karthik NayakSep 3, 2015
  47. 08/13 ref-filter: add support to sort by versionKarthik Nayak, Sep 1, 2015
  48. 09/13 ref-filter: add option to match literal patternKarthik Nayak, Sep 1, 2015
  49. 10/13 tag.c: use 'ref-filter' data structuresKarthik Nayak, Sep 1, 2015
  50. 11/13 tag.c: use 'ref-filter' APIsKarthik Nayak, Sep 1, 2015
  51. Matthieu MoySep 2, 2015
  52. Junio C HamanoSep 2, 2015
  53. Karthik NayakSep 2, 2015
  54. Matthieu MoySep 2, 2015
  55. Junio C HamanoSep 2, 2015
  56. Karthik NayakSep 3, 2015
  57. 12/13 tag.c: implement '--format' optionKarthik Nayak, Sep 1, 2015
  58. 13/13 tag.c: implement '--merged' and '--no-merged' optionsKarthik Nayak, Sep 1, 2015

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.