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 <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael J Gruber committed
Feb 17, 2011 at 08:44 UTC
2485eab55cc0dcab34311ecd0ac52038aa9d9db4
2 files changed
+3
-1
builtin/patch-id.c
+2
@@ -73,6 +73,8 @@ int get_one_patchid(unsigned char *next_sha1, git_SHA_CTX *ctx)
73
p += 7;
74
else if (!memcmp(line, "From ", 5))
75
p += 5;
76
+ else if (!memcmp(line, "\\ ", 2) && 12 < strlen(line))
77
+ continue;
78
79
if (!get_sha1_hex(p, next_sha1)) {
80
found_next = 1;
t/t4204-patch-id.sh
+1
-1
@@ -94,7 +94,7 @@ index e69de29..6178079 100644
94
+b
95
EOF
96
97
-test_expect_failure 'patch-id handles no-nl-at-eof markers' '
97
+test_expect_success 'patch-id handles no-nl-at-eof markers' '
98
cat nonl | calc_patch_id nonl &&
99
cat withnl | calc_patch_id withnl &&
100
test_cmp patch-id_nonl patch-id_withnl