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

Re: [PATCH v5 03/11] ref-filter: add option to pad atoms to the right

From
Karthik Nayak <karthik.188@gmail.com>
Date
Jul 27, 2015, 18:42 UTC
Message-ID
<CAOLa=ZRVMnqxb-E29f_53igzJDTWNU0yjVACSq1CK8TCbaM-9w@mail.gmail.com>
In-Reply-To
<vpqk2tl4mvx.fsf@anie.imag.fr>

On Mon, Jul 27, 2015 at 9:24 PM, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:

Show 23 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>>
>>> See my remark on previous patch: this test is not sufficient. You do
>>> not only need to check that %(padright) is taken into account, but you
>>> also need to check that it is taken into account for the right atom and
>>> only this one. I'd suggest
>>>
>>> --format '%(refname)%(padright:25)|%(refname)|%(refname)|'
>>>
>>> Only the middle column should be padded.
>>
>> This actually raises an interesting point.  It is equally valid to
>> view that format string as requesting to pad the first "|" with 24
>> spaces; in other words, %(padright:N) would apply to the next span,
>> be it a literal string up to the next %(atom), or the %(atom) that
>> comes immediately after it.
>
> For an arbitrary %(modifier), I'd agree, but in the particular case of
> %(padright), I think it only makes sense if applied to something of
> variable length
>

I agree with Matthieu here, Other than atom values, any user defined string would be of known size, hence padding for such things would make no sense.

Show 12 quoted lines
>> The thing is, the above _might_ be an OK way to ask the middle
>> refname to be padded, but I somehow find it very unnatural and
>> unintuitive to expect that this:
>>
>>       --format '%(padright:25)A Very Long Irrelevancy%(refname)'
>
> Yes, but on the other hand we already have:
>
>   git log --format='%<|(50)A very long irrevlevancy|%an|'
>
> that pads/truncate %an. So, consistancy would dictate that Karthik's
> version is the right one.
Sorry but I didn't understand what you're trying to say here, Matthieu.
Show 8 quoted lines
>
>> My preference between the three is "%(padright:4)", etc. to apply to
>> the "next span", but I can live with "it is an error to pad-right
>> a far-away %(atom)".
>
> I think there are valid argument for the 3 versions. I'm fine with any
> of them, as long as there's a test that shows which one is picked.
>
Makes sense, thanks both of you :)
-- 
Regards,
Karthik Nayak
Previous: Matthieu MoyNext: Matthieu Moy
Message 14 of 38 in “port tag.c to use ref-filter APIs”
  1. 00/11 port tag.c to use ref-filter APIsKarthik Nayak, Jul 27, 2015
  2. 01/11 ref-filter: introduce 'ref_formatting_state'Karthik Nayak, Jul 27, 2015
  3. 02/11 ref-filter: make `color` use `ref_formatting_state`Karthik Nayak, Jul 27, 2015
  4. Matthieu MoyJul 27, 2015
  5. Junio C HamanoJul 27, 2015
  6. Karthik NayakJul 27, 2015
  7. Karthik NayakJul 27, 2015
  8. Matthieu MoyJul 27, 2015
  9. Karthik NayakJul 27, 2015
  10. 03/11 ref-filter: add option to pad atoms to the rightKarthik Nayak, Jul 27, 2015
  11. Matthieu MoyJul 27, 2015
  12. Junio C HamanoJul 27, 2015
  13. Matthieu MoyJul 27, 2015
  14. Karthik NayakJul 27, 2015
  15. Matthieu MoyJul 27, 2015
  16. Karthik NayakJul 27, 2015
  17. Junio C HamanoJul 27, 2015
  18. Karthik NayakJul 27, 2015
  19. Eric SunshineJul 28, 2015
  20. Karthik NayakJul 29, 2015
  21. 04/11 ref-filter: add option to filter only tagsKarthik Nayak, Jul 27, 2015
  22. 05/11 ref-filter: support printing N lines from tag annotationKarthik Nayak, Jul 27, 2015
  23. 06/11 ref-filter: add support to sort by versionKarthik Nayak, Jul 27, 2015
  24. 07/11 ref-filter: add option to match literal patternKarthik Nayak, Jul 27, 2015
  25. Matthieu MoyJul 27, 2015
  26. Karthik NayakJul 27, 2015
  27. Karthik NayakJul 27, 2015
  28. Matthieu MoyJul 27, 2015
  29. Karthik NayakJul 27, 2015
  30. Eric SunshineJul 28, 2015
  31. Karthik NayakJul 29, 2015
  32. Karthik NayakJul 30, 2015
  33. 08/11 tag.c: use 'ref-filter' data structuresKarthik Nayak, Jul 27, 2015
  34. 09/11 tag.c: use 'ref-filter' APIsKarthik Nayak, Jul 27, 2015
  35. 10/11 tag.c: implement '--format' optionKarthik Nayak, Jul 27, 2015
  36. 11/11 tag.c: implement '--merged' and '--no-merged' optionsKarthik Nayak, Jul 27, 2015
  37. Matthieu MoyJul 27, 2015
  38. Karthik NayakJul 27, 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.