From: Junio C Hamano Date: Tue, 12 Feb 2013 19:13:42 GMT Subject: Re: [PATCH v4 05/12] sequencer.c: recognize "(cherry picked from ..." as part of s-o-b footer Message-ID: <7v621xgxax.fsf@alter.siamese.dyndns.org> In-Reply-To: <1360664260-11803-6-git-send-email-drafnel@gmail.com> Brandon Casey writes: > When 'cherry-pick -s' is used to append a signed-off-by line to a cherry > picked commit, it does not currently detect the "(cherry picked from..." > that may have been appended by a previous 'cherry-pick -x' as part of the > s-o-b footer and it will insert a blank line before appending a new s-o-b. > > Let's detect "(cherry picked from...)" as part of the footer so that we > will produce this: > ... > +static int is_cherry_picked_from_line(const char *buf, int len) > +{ > + /* > + * We only care that it looks roughly like (cherry picked from ...) > + */ > + return len > strlen(cherry_picked_prefix) + 1 && > + !prefixcmp(buf, cherry_picked_prefix) && buf[len - 1] == ')'; > +} Does the first "is it longer than the prefix?" check matter? If it is not, prefixcmp() would not match anyway, no?