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 <ande...@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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to