Re: [PATCH] commit.c:record_author_date() use skip_prefix() instead of starts_with()
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 3, 2014, 19:52 UTC
- Message-ID
- <CAPig+cQrnKRDo88qq=3Ujjjwv0rn4H+eovAeAnmODUDPr00m8g@mail.gmail.com>
- In-Reply-To
- <xmqqmwh7qg6v.fsf@gitster.dls.corp.google.com>
On Mon, Mar 3, 2014 at 1:40 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
> Michael Haggerty <mhagger@alum.mit.edu> writes:
>
>>> - if (!starts_with(buf, "author ")) {
>>> + if (!skip_prefix(buf, "author ")) {
>>
>> If this is the only change, there is not much point, is there? How does
>> this help? Perhaps there is some way to take advantage of the
>> difference between starts_with() and skip_prefix() to simplify the rest
>> of the function?
>
> I admit I lost track, but wasn't there a discussion to use
> starts_with/ends_with when appropriate (namely, the caller is
> absolutely not interested in what the remainder of the string is
> after skipping the prefix), moving away from skip_prefix()? Isn't
> this change going in the wrong direction?Yes, it would be going in the wrong direction if this was all there was to it, but the particular GSoC microproject [1] which inspired this (incomplete) submission expects that the potential student will dig deeper and discover how skip_prefix() can be used to achieve greater simplification in record_author_date() and in other places in the same file.
[1]: https://github.com/git/git.github.io/blob/master/SoC-2014-Microprojects.md