Re: What's cooking in git.git (Jan 2016, #02; Mon, 11)

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

 



Jeff King <peff@xxxxxxxx> writes:

> On Tue, Jan 12, 2016 at 10:47:25AM -0800, Junio C Hamano wrote:
>
>> I think strbuf_getline() that handles the payload as "text" without
>> having _crlf() suffix is an ideal endgame in the longer term, but I
>> do not think it is a good idea to do that as a flag-day change.  So
>> I am inclined not to change the function names around that feature
>> in this series.  Others can do the wholesale rename as a separate
>> follow-up topic when the tree is quiescent.
>
> Yeah, I think we would want to catch topics in flight. Should the end of
> this series then be to _remove_ strbuf_getline()? Callers should be
> using strbuf_getline_crlf() if they want text lines, and
> strbuf_getdelim() if they do not.
>
> Topics in flight will need fixed up, but that's OK; the breakage (and
> the fix) will be obvious.
>
> And then after a quiet period we can drop the "_crlf()" and have
> strbuf_getline() back.

Actually, I think a patch that

 - renames strbuf_getline() to strbuf_getdelim(); and
 - renames strbuf_getline_crlf() to strbuf_getline() 

on top of the series we already have is sufficient to bring the
endgame state to us.  The new strbuf_getline() has a different
function signature from the traditional one, so any topic in flight
that is unaware of this series can easily be caught, and we can do
this without a quiet period.

A more interesting question is if strbuf_getdelim() should take an
arbitrary byte as its third parameter.  As I said elsewhere, the
only reason why it is not a "do we use LF or do we use NUL?"
boolean is because I wrote these codepaths anticipating that there
might be a value other than NUL and LF that could be useful when I
introduced line_termination long time ago, but no useful caller that
uses other useful value has emerged, so I think the interface was
too broad and too general for its own good.

It becomes very tempting not to do strbuf_getdelim() at all, but
instead rewrite the current calls to strbuf_getline() to call one of
two functions, i.e. strbuf_getline_lf() and strbuf_getline_nul(),
when we rename strbuf_getline_crlf() to strbuf_getline().

By going that route, those who want to help CRLF situation further
can then concentrate on output from "git grep strbuf_getline_lf()",
identify the ones that can be safely turned into strbuf_getline(),
and do the conversion.

--
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]