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

[BUG/PATCH] t9350-fast-export: Add failing test for symlink-to-directory

From
Anders Kaseorg <andersk@mit.edu>
Date
Aug 19, 2015, 19:46 UTC
Message-ID
<alpine.DEB.2.10.1508191532330.31851@buzzword-bingo.mit.edu>

git fast-export | git fast-import fails to preserve a commit that replaces a symlink with a directory. Add a failing test case demonstrating this bug.

The fast-export output for the commit in question looks like
  commit refs/heads/master
  mark :4
  author …
  committer …
  data 4
  two
  M 100644 :1 foo/world
  D foo

fast-import deletes the symlink foo and ignores foo/world. Swapping the M line with the D line would give the correct result.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
 t/t9350-fast-export.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index 66c8b0a..5fb8a04 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -419,6 +419,30 @@ test_expect_success 'directory becomes symlink'        '
 	(cd result && git show master:foo)
 '
 
+test_expect_failure 'symlink becomes directory'        '
+	git init symlinktodir &&
+	git init symlinktodirresult &&
+	(
+		cd symlinktodir &&
+		mkdir bar &&
+		echo hello > bar/world &&
+		test_ln_s_add bar foo &&
+		git add foo bar/world &&
+		git commit -q -mone &&
+		git rm foo &&
+		mkdir foo &&
+		echo hello > foo/world &&
+		git add foo/world &&
+		git commit -q -mtwo
+	) &&
+	(
+		cd symlinktodir &&
+		git fast-export master -- foo |
+		(cd ../symlinktodirresult && git fast-import --quiet)
+	) &&
+	(cd symlinktodirresult && git show master:foo)
+'
+
 test_expect_success 'fast-export quotes pathnames' '
 	git init crazy-paths &&
 	(cd crazy-paths &&
-- 
2.5.0
Next: Jeff King
Message 1 of 4 in “t9350-fast-export: Add failing test for symlink-to-directory”
  1. t9350-fast-export: Add failing test for symlink-to-directoryAnders Kaseorg, Aug 19, 2015
  2. Jeff KingAug 21, 2015
  3. Anders KaseorgAug 21, 2015
  4. Jeff KingAug 24, 2015

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.