git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] apply: demonstrate a problem applying svn diffs

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 15, 2018, 00:29 UTC
Message-ID
<24000fd64887994bfc5b70b5e4bd3d8c92661f81.1518654532.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1518654532.git.johannes.schindelin@gmx.de>

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>
---
 t/t4135-apply-weird-filenames.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index 27cb0009fb1..b14b8085786 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -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
-- 
2.16.1.windows.1
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 2 of 4 in “Teach `git apply` to accept Subversion-generated diffs”
  1. 0/2 Teach `git apply` to accept Subversion-generated diffsJohannes Schindelin, Feb 15, 2018
  2. 1/2 apply: demonstrate a problem applying svn diffsJohannes Schindelin, Feb 15, 2018
  3. 2/2 apply: handle Subversion diffs with /dev/null gracefullyJohannes Schindelin, Feb 15, 2018
  4. Junio C HamanoFeb 15, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.