On Mon, Aug 31, 2015 at 1:01 PM, Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> wrote: > 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. > 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 :) -- Regards, Karthik Nayak -- 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