Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ TESTS = tests/newline1/run-test \
tests/flip17/run-test \
tests/flip18/run-test \
tests/flip19/run-test \
tests/flip20/run-test \
tests/unline1/run-test \
tests/nul0/run-test \
tests/nul1/run-test \
Expand Down
9 changes: 9 additions & 0 deletions src/interdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,15 @@ remove_line (struct lines_info *lines, const char *line,
}
}

if (!kill) {
/* The line we were asked to remove is not present (for
* example when the two patches do not commute). There is
* nothing to do. */
if (debug)
printf ("Nothing to remove at %lu: %s", n, line);
return;
}

at = kill;
while (at) {
at->n--;
Expand Down
30 changes: 30 additions & 0 deletions tests/flip20/run-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

# This is a flipdiff(1) testcase.
# Test: non-commuting patches where the second patch removes a line that
# the first patch had added. flipdiff used to crash on this input.


. ${top_srcdir-.}/tests/common.sh

cat << EOF > file.orig
a
b
EOF

cat << EOF > file
a-m
b-y
EOF

${DIFF} -u file.orig file > patch1

mv -f file file.orig
cat << EOF > file
a
b-y
EOF

${DIFF} -u file.orig file > patch2

${FLIPDIFF} patch1 patch2 > patch-flipped || exit 1