Re: [PATCH 2/2] git-patch-id: do not trip over "no newline" markers
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 16, 2011, 20:05 UTC
- Message-ID
- <7vwrkziw2i.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <144f7a4824abecaf87f862ed9e60587456128b41.1297875236.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 21 quoted lines
> Currently, patch-id trips over our very own diff extension for marking > the absence of newline at EOF. > > Fix it. (Ignore it, it's whitespace.) > > Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> > --- > builtin/patch-id.c | 2 ++ > t/t4204-patch-id.sh | 2 +- > 2 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/builtin/patch-id.c b/builtin/patch-id.c > index 5125300..653d958 100644 > --- a/builtin/patch-id.c > +++ b/builtin/patch-id.c > @@ -73,6 +73,8 @@ int get_one_patchid(unsigned char *next_sha1, git_SHA_CTX *ctx) > p += 7; > else if (!memcmp(line, "From ", 5)) > p += 5; > + else if (!memcmp(line, "\\ No newline at end of file", 27)) > + continue;
Good spotting, except that this string is a bit too specific to git and GNU diff run in the C or ??_en locales. An early draft of "git apply" used to have the same string but the string was removed before the command was released to the wild with a lot weaker condition (grep for "l10n" in builtin/apply.c).