apply: demonstrate a problem applying svn diffs
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 15 Feb 2018 00:29:27 +0000 (01:29 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Feb 2018 19:09:01 +0000 (11:09 -0800)
Subversion generates diffs that contain funny ---/+++ lines containing
more than just the file names. Example:

--- a/trunk/README (revision 4711)
+++ /dev/null (nonexistent)

Let's add a test case demonstrating that apply cannot handle the
/dev/null line (although it can handle the trunk/README line just fine).

Reported in https://github.com/git-for-windows/git/issues/1489

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4135-apply-weird-filenames.sh
index 27cb0009fb1ed52b749785c31081b3097fef0022..b14b8085786f579a301d584a0175ba1079960108 100755 (executable)
@@ -89,4 +89,21 @@ test_expect_success 'traditional, whitespace-damaged, colon in timezone' '
        test_cmp expected "post image.txt"
 '
 
+cat >diff-from-svn <<\EOF
+Index: Makefile
+===================================================================
+diff --git a/branches/Makefile
+deleted file mode 100644
+--- a/branches/Makefile        (revision 13)
++++ /dev/null  (nonexistent)
+@@ +1 0,0 @@
+-
+EOF
+
+test_expect_failure 'apply handles a diff generated by Subversion' '
+       >Makefile &&
+       git apply -p2 diff-from-svn &&
+       test_path_is_missing Makefile
+'
+
 test_done