Re: [PATCH v14 00/13] Port tag.c to use ref-filter.c
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Aug 31, 2015, 11:36 UTC
- Message-ID
- <CAOLa=ZRJC5FD08Ljh=exM5GU8vzDAo2YnjQpScB8nwa9qDdTeA@mail.gmail.com>
- In-Reply-To
- <vpqa8t7j4nf.fsf@anie.imag.fr>
On Mon, Aug 31, 2015 at 1:01 PM, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:
Show 37 quoted lines
> 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 :)
Show 5 quoted lines
> 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