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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Karthik Nayak <karthik.188@xxxxxxxxx> 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.

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

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]