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

Re: [PATCH v14 00/13] Port tag.c to use ref-filter.c

From
Karthik Nayak <karthik.188@gmail.com>
Date
Sep 1, 2015, 17:37 UTC
Message-ID
<CAOLa=ZS3jt57zMwKcWYF6Nfa=n4-rjCbhq9QSeo91hAsN3F2PA@mail.gmail.com>
In-Reply-To
<CAOLa=ZRJC5FD08Ljh=exM5GU8vzDAo2YnjQpScB8nwa9qDdTeA@mail.gmail.com>
On Mon, Aug 31, 2015 at 5:06 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
Show 53 quoted lines
> On Mon, Aug 31, 2015 at 1:01 PM, Matthieu Moy
> <Matthieu.Moy@grenoble-inp.fr> wrote:
>> Karthik Nayak <karthik.188@gmail.com> writes:
>>
>>> * We perform quoting on each layer of nested alignment.
>>
>> I do not understand why.
>>
>> For example, using the tip of karthik/exp on GitHub (on top of this
>> series, d91419b (ref-filter: adopt get_head_description() from branch.c,
>> 2015-08-23)):
>>
>> git for-each-ref --shell \
>>   --format 'x=%(if)foo%(then)%(align:10)XXX%(end)%(else) not foo %(end)'
>>
>> I'd expect an output like:
>>
>> x='XXX      '
>>
>> and instead I get:
>>
>> x=''\''XXX       '\'''
>>
>> which assigns the value 'XXX       ' (including the quotes) to $x. I do
>> not see a use-case for this (well, I could imagine one where we would
>> later call eval "$x", that seems rather far-fetched).
>>
>> I think the quoting should be:
>>
>> 1) When the stack contains only the initial element, quote individual
>>    atoms.
>>
>> 2) When the stack contains exactly two elements and encountering a %(end)
>>    or %(else), quote the entire strbuf of the 2nd level when appending to
>>    the 1st level.
>>
>> 3) When the stack contains more than two elements, perform no quoting at
>>    all. The quoting will be done later by #2.
>>
>
> Yea, That's what Eric was saying, I even made changes which sum up to
> what you're saying :)
>
>> I found a segfault while testing:
>>
>> $ git for-each-ref --format 'x=%(if)%(align:10)%(end)%(then)%(align:10)XXX%(end)%(else)%(end)' --shell
>> zsh: segmentation fault
>>
>
> I wouldn't worry about this ATM, I have made so many changes that the
> tip is barely changed to reflect those, though I'll have a look at it
> :)
>
Was a dereferencing error, fixed it now :)
-- 
Regards,
Karthik Nayak
Previous: Karthik Nayak
Message 52 of 52 in “Port tag.c to use ref-filter.c”
  1. 00/13 Port tag.c to use ref-filter.cKarthik Nayak, Aug 29, 2015
  2. 01/13 ref-filter: move `struct atom_value` to ref-filter.cKarthik Nayak, Aug 29, 2015
  3. 02/13 ref-filter: introduce ref_formatting_state and ref_formatting_stackKarthik Nayak, Aug 29, 2015
  4. 03/13 utf8: add function to align a string into given strbufKarthik Nayak, Aug 29, 2015
  5. Torsten BögershausenAug 29, 2015
  6. Karthik NayakAug 29, 2015
  7. 04/13 ref-filter: implement an `align` atomKarthik Nayak, Aug 29, 2015
  8. Eric SunshineAug 30, 2015
  9. Karthik NayakAug 30, 2015
  10. Eric SunshineAug 30, 2015
  11. Karthik NayakAug 31, 2015
  12. Eric SunshineAug 31, 2015
  13. Matthieu MoyAug 31, 2015
  14. Eric SunshineAug 31, 2015
  15. Karthik NayakSep 1, 2015
  16. Matthieu MoySep 1, 2015
  17. Karthik NayakSep 1, 2015
  18. Karthik NayakAug 30, 2015
  19. Eric SunshineAug 30, 2015
  20. Karthik NayakAug 31, 2015
  21. Junio C HamanoAug 30, 2015
  22. Eric SunshineAug 30, 2015
  23. Karthik NayakAug 31, 2015
  24. Karthik NayakAug 31, 2015
  25. Matthieu MoyAug 31, 2015
  26. Karthik NayakAug 31, 2015
  27. 05/13 ref-filter: add option to filter out tags, branches and remotesKarthik Nayak, Aug 29, 2015
  28. Eric SunshineAug 30, 2015
  29. Karthik NayakAug 30, 2015
  30. Eric SunshineAug 30, 2015
  31. 06/13 ref-filter: introduce format_ref_array_item()Karthik Nayak, Aug 29, 2015
  32. Eric SunshineAug 30, 2015
  33. Karthik NayakAug 30, 2015
  34. Karthik NayakAug 30, 2015
  35. 07/13 ref-filter: add support for %(contents:lines=X)Karthik Nayak, Aug 29, 2015
  36. Eric SunshineAug 30, 2015
  37. Karthik NayakAug 30, 2015
  38. Eric SunshineAug 30, 2015
  39. Karthik NayakAug 30, 2015
  40. Eric SunshineAug 30, 2015
  41. Karthik NayakAug 31, 2015
  42. 08/13 ref-filter: add support to sort by versionKarthik Nayak, Aug 29, 2015
  43. 09/13 ref-filter: add option to match literal patternKarthik Nayak, Aug 29, 2015
  44. 10/13 tag.c: use 'ref-filter' data structuresKarthik Nayak, Aug 29, 2015
  45. 11/13 tag.c: use 'ref-filter' APIsKarthik Nayak, Aug 29, 2015
  46. 12/13 tag.c: implement '--format' optionKarthik Nayak, Aug 29, 2015
  47. 13/13 tag.c: implement '--merged' and '--no-merged' optionsKarthik Nayak, Aug 29, 2015
  48. Matthieu MoyAug 31, 2015
  49. Karthik NayakAug 31, 2015
  50. Matthieu MoyAug 31, 2015
  51. Karthik NayakAug 31, 2015
  52. Karthik NayakSep 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.