Skip to content

Commit

Permalink
git-patch-id: do not trip over "no newline" markers
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael J Gruber authored and Junio C Hamano committed Feb 17, 2011
1 parent f2b5e7a commit 2485eab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions builtin/patch-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, "\\ ", 2) && 12 < strlen(line))
continue;

if (!get_sha1_hex(p, next_sha1)) {
found_next = 1;
Expand Down
2 changes: 1 addition & 1 deletion t/t4204-patch-id.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ index e69de29..6178079 100644
+b
EOF

test_expect_failure 'patch-id handles no-nl-at-eof markers' '
test_expect_success 'patch-id handles no-nl-at-eof markers' '
cat nonl | calc_patch_id nonl &&
cat withnl | calc_patch_id withnl &&
test_cmp patch-id_nonl patch-id_withnl
Expand Down

0 comments on commit 2485eab

Please sign in to comment.