git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Anders Kaseorg <andersk@mit.edu>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [BUG/PATCH] t9350-fast-export: Add failing test for symlink-to-directory
Date: Wed, 19 Aug 2015 15:46:27 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1508191532330.31851@buzzword-bingo.mit.edu> (raw)

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

             reply	other threads:[~2015-08-19 19:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19 19:46 Anders Kaseorg [this message]
2015-08-21 14:58 ` [BUG/PATCH] t9350-fast-export: Add failing test for symlink-to-directory Jeff King
2015-08-21 16:47   ` Anders Kaseorg
2015-08-24  5:25     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1508191532330.31851@buzzword-bingo.mit.edu \
    --to=andersk@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).