Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-02-28 08:58:30 +0300
committerJunio C Hamano <gitster@pobox.com>2011-02-28 08:58:30 +0300
commitc8cdbf2badcc500ec68c506a3b4bda9b1e18995f (patch)
tree319dadc562b6b4b8a607ec262f07fed482ce9acc
parent66a6a3142074473c91eb7f11de4d745647d43540 (diff)
parent2485eab55cc0dcab34311ecd0ac52038aa9d9db4 (diff)
Merge branch 'mg/patch-id'
* mg/patch-id: git-patch-id: do not trip over "no newline" markers git-patch-id: test for "no newline" markers
-rw-r--r--builtin/patch-id.c2
-rwxr-xr-xt/t4204-patch-id.sh36
2 files changed, 38 insertions, 0 deletions
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index 512530022e..49a0472a9b 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, "\\ ", 2) && 12 < strlen(line))
+ continue;
if (!get_sha1_hex(p, next_sha1)) {
found_next = 1;
diff --git a/t/t4204-patch-id.sh b/t/t4204-patch-id.sh
index 68e2652814..d2c930de87 100755
--- a/t/t4204-patch-id.sh
+++ b/t/t4204-patch-id.sh
@@ -63,4 +63,40 @@ test_expect_success 'patch-id supports git-format-patch MIME output' '
test_cmp patch-id_master patch-id_same
'
+cat >nonl <<\EOF
+diff --git i/a w/a
+index e69de29..2e65efe 100644
+--- i/a
++++ w/a
+@@ -0,0 +1 @@
++a
+\ No newline at end of file
+diff --git i/b w/b
+index e69de29..6178079 100644
+--- i/b
++++ w/b
+@@ -0,0 +1 @@
++b
+EOF
+
+cat >withnl <<\EOF
+diff --git i/a w/a
+index e69de29..7898192 100644
+--- i/a
++++ w/a
+@@ -0,0 +1 @@
++a
+diff --git i/b w/b
+index e69de29..6178079 100644
+--- i/b
++++ w/b
+@@ -0,0 +1 @@
++b
+EOF
+
+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
+'
test_done