Subject: Re: [PATCH v2 09/34] sequencer (rebase -i): write an author-script file

From: Junio C Hamano <[email-masked]>
Date: Mon, 19 Dec 2016 17:32:19 -0800

Johannes Schindelin <[email-masked]> writes:

> Hi Junio,
>
> On Thu, 15 Dec 2016, Junio C Hamano wrote:
>
>> Johannes Schindelin <[email-masked]> writes:
>> 
>> > +	strbuf_addstr(&buf, "GIT_AUTHOR_NAME='");
>> > +	while (*message && *message != '\n' && *message != '\r')
>> > +		if (skip_prefix(message, " <", &message))
>> > +			break;
>> > +		else if (*message != '\'')
>> > +			strbuf_addch(&buf, *(message++));
>> > +		else
>> > +			strbuf_addf(&buf, "'\\\\%c'", *(message++));
>> > +	strbuf_addstr(&buf, "'\nGIT_AUTHOR_EMAIL='");
>> > +	while (*message && *message != '\n' && *message != '\r')
>> > +		if (skip_prefix(message, "> ", &message))
>> > +			break;
>> > +		else if (*message != '\'')
>> > +			strbuf_addch(&buf, *(message++));
>> > +		else
>> > +			strbuf_addf(&buf, "'\\\\%c'", *(message++));
>> 
>> Aren't these reading from an in-core commit object?  
>> 
>> If so, it should use split_ident_line() for consistency with other
>> parts of the system to do this parsing.  We should also already have
>> a helper for simple shell-quoting in quote.c and you would want to
>> use that instead of open coding like this.
>
> We keep coming back to the same argument. You want this quoting/dequoting
> to be turned into a full-fledged parser. And I keep pointing out that the
> code here does not *need* to parse but only construct an environment
> block.

I am afraid you are mis-reading me.  I see a code that _READS_ some
data format, for which we already have a parser, and then write out
things based on what it read.  I do not want you to make anything
into a full-fledged parser---I just do not want to see an ad-hoc
reader and instead the code to USE existing parser.