Skip to content

Commit 3b7703f

Browse files
committed
New test case, fullheader3, with fix (bug #1226985).
1 parent 78e1585 commit 3b7703f

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ TESTS = tests/newline1/run-test \
216216
tests/stdin/run-test \
217217
tests/splitdiffD/run-test \
218218
tests/fullheader1/run-test \
219-
tests/fullheader2/run-test
219+
tests/fullheader2/run-test \
220+
tests/fullheader3/run-test
220221

221222
# These ones don't work yet.
222223
# Feel free to send me patches. :-)

src/filterdiff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ do_context (FILE *f, char **header, unsigned int num_headers,
910910
return ret;
911911
}
912912

913-
#define MAX_HEADERS 5
913+
#define MAX_HEADERS 6
914914
static int filterdiff (FILE *f, const char *patchname)
915915
{
916916
static unsigned long linenum = 1;

tests/fullheader3/run-test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
# This is a filterdiff(1) testcase.
4+
# Handle git format-patch output containing remove-file diffs.
5+
# From: https://bugzilla.redhat.com/show_bug.cgi?id=1226985
6+
7+
. ${top_srcdir-.}/tests/common.sh
8+
9+
cat <<"EOF" > git-output
10+
diff --git a/a b/a
11+
deleted file mode 100644
12+
index 7898192..0000000
13+
--- a/a
14+
+++ /dev/null
15+
@@ -1 +0,0 @@
16+
-a
17+
EOF
18+
19+
${FILTERDIFF} git-output 2>errors >output || { cat errors; exit 1; }
20+
[ -s errors ] && { cat errors; exit 1; }
21+
cmp git-output output || exit 1
22+
exit 0

0 commit comments

Comments
 (0)