git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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).

Previous: Michael J GruberNext: Michael J Gruber
Message 5 of 18 in “Why does git-patch-id(1) sometimes print two lines, one of which has commit = 0000000000000000000000000000000000000000”
  1. Ævar Arnfjörð BjarmasonFeb 16, 2011
  2. Michael J GruberFeb 16, 2011
  3. 1/2 git-patch-id: test for "no newline" markersMichael J Gruber, Feb 16, 2011
  4. 2/2 git-patch-id: do not trip over "no newline" markersMichael J Gruber, Feb 16, 2011
  5. Junio C HamanoFeb 16, 2011
  6. 1/2 git-patch-id: test for "no newline" markersMichael J Gruber, Feb 17, 2011
  7. Jakub NarebskiFeb 17, 2011
  8. Michael J GruberFeb 17, 2011
  9. 2/2 git-patch-id: do not trip over "no newline" markersMichael J Gruber, Feb 17, 2011
  10. Jeff KingFeb 18, 2011
  11. Michael J GruberFeb 18, 2011
  12. 1/2 git-patch-id: test for "no newline" markersMichael J Gruber, Feb 18, 2011
  13. 2/2 git-patch-id: do not trip over "no newline" markersMichael J Gruber, Feb 18, 2011
  14. Jeff KingFeb 18, 2011
  15. Michael J GruberFeb 18, 2011
  16. Jeff KingFeb 18, 2011
  17. Jakub NarebskiFeb 18, 2011
  18. Jeff KingFeb 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.