Skip to content

Commit f2b5e7a

Browse files
Michael J Grubergitster
authored andcommitted
git-patch-id: test for "no newline" markers
Currently, patch-id trips over our very own output that marks the absence of newline at EOF. Expose this in a test. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ed863a commit f2b5e7a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

t/t4204-patch-id.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,40 @@ test_expect_success 'patch-id supports git-format-patch MIME output' '
6363
test_cmp patch-id_master patch-id_same
6464
'
6565

66+
cat >nonl <<\EOF
67+
diff --git i/a w/a
68+
index e69de29..2e65efe 100644
69+
--- i/a
70+
+++ w/a
71+
@@ -0,0 +1 @@
72+
+a
73+
\ No newline at end of file
74+
diff --git i/b w/b
75+
index e69de29..6178079 100644
76+
--- i/b
77+
+++ w/b
78+
@@ -0,0 +1 @@
79+
+b
80+
EOF
81+
82+
cat >withnl <<\EOF
83+
diff --git i/a w/a
84+
index e69de29..7898192 100644
85+
--- i/a
86+
+++ w/a
87+
@@ -0,0 +1 @@
88+
+a
89+
diff --git i/b w/b
90+
index e69de29..6178079 100644
91+
--- i/b
92+
+++ w/b
93+
@@ -0,0 +1 @@
94+
+b
95+
EOF
96+
97+
test_expect_failure '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
101+
'
66102
test_done

0 commit comments

Comments
 (0)