All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add new testcase to show that fast-export can squash merge commits
@ 2009-02-11  6:03 newren
  2009-02-11  6:03 ` [PATCH] fast-export: ensure we traverse commits in topological order newren
  0 siblings, 1 reply; 10+ messages in thread
From: newren @ 2009-02-11  6:03 UTC (permalink / raw)
  To: git; +Cc: Johannes.Schindelin, Elijah Newren

From: Elijah Newren <newren@gmail.com>

Signed-off-by: Elijah Newren <newren@gmail.com>
---
I'm not certain this testcase will actually trigger the bug for everyone,
since I don't know the order of commits used by git rev-list.  It does
trigger it for me.  What you need is a history that looks like
    B--D
   /  /
  A--C
with the master branch pointing at D, and have "git rev-list --all" show
these commits in the order
  C
  D
  B
  A
If you have such a repository, "git fast-export --all" will give
instructions to create a master branch that only contains D, B, and A.
 t/t9301-fast-export.sh |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 9985721..a1ee400 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -259,4 +259,33 @@ test_expect_success 'cope with tagger-less tags' '
 
 '
 
+test_expect_success 'avoid squashing merges' '
+
+	mkdir repo &&
+	cd repo &&
+	git init &&
+	echo fee-fi-fo-fum > giant &&
+	git add giant &&
+	git commit -m "Initial commit" &&
+	git branch alternate_root &&
+	echo hello > world &&
+	git add world &&
+	git commit -m "Commit on master" &&
+	git checkout alternate_root &&
+	echo foo > bar &&
+	git add bar &&
+	git commit -m "Commit on alternate_root" &&
+	git checkout master &&
+	git merge alternate_root &&
+	MASTER=$(git rev-parse --verify refs/heads/master) &&
+	rm -rf ../new &&
+	mkdir ../new &&
+	git --git-dir=../new/.git init &&
+	git fast-export --all |
+	(cd ../new &&
+	 git fast-import &&
+	 test $MASTER = $(git rev-parse --verify refs/heads/master))
+
+'
+
 test_done
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-02-11 17:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-11  6:03 [PATCH] Add new testcase to show that fast-export can squash merge commits newren
2009-02-11  6:03 ` [PATCH] fast-export: ensure we traverse commits in topological order newren
2009-02-11 10:25   ` Johannes Schindelin
2009-02-11 10:48     ` Mike Ralphson
2009-02-11 10:59       ` Johannes Schindelin
2009-02-11 13:56       ` Jeff King
2009-02-11 15:18         ` Johannes Schindelin
2009-02-11 17:37           ` Jeff King
2009-02-11 15:23         ` Elijah Newren
2009-02-11 17:53           ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.