Skip to content

Commit 2485eab

Browse files
Michael J Grubergitster
authored andcommitted
git-patch-id: do not trip over "no newline" markers
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f2b5e7a commit 2485eab

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

builtin/patch-id.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ int get_one_patchid(unsigned char *next_sha1, git_SHA_CTX *ctx)
7373
p += 7;
7474
else if (!memcmp(line, "From ", 5))
7575
p += 5;
76+
else if (!memcmp(line, "\\ ", 2) && 12 < strlen(line))
77+
continue;
7678

7779
if (!get_sha1_hex(p, next_sha1)) {
7880
found_next = 1;

t/t4204-patch-id.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ index e69de29..6178079 100644
9494
+b
9595
EOF
9696

97-
test_expect_failure 'patch-id handles no-nl-at-eof markers' '
97+
test_expect_success 'patch-id handles no-nl-at-eof markers' '
9898
cat nonl | calc_patch_id nonl &&
9999
cat withnl | calc_patch_id withnl &&
100100
test_cmp patch-id_nonl patch-id_withnl

0 commit comments

Comments
 (0)