From 25cd5b557575d8cf6eb5b92f866c8a34f010d622 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 10 Nov 2008 23:44:41 +0100 Subject: [PATCH] Add tests for directory/submodule and file/submodule conflicts These fail for a large part. Signed-off-by: Johannes Schindelin --- t/t7404-submodule-tree.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 t/t7404-submodule-tree.sh diff --git a/t/t7404-submodule-tree.sh b/t/t7404-submodule-tree.sh new file mode 100755 index 0000000000..7c7afd90f5 --- /dev/null +++ b/t/t7404-submodule-tree.sh @@ -0,0 +1,91 @@ +#!/bin/sh +# +# Copyright (c) 2008 Johannes E. Schindelin +# + +test_description='git submodule/tree conflict + +Tests what happens when a subdirectory becomes a submodule all of a sudden. +' + +. ./test-lib.sh + +test_expect_success setup ' + + mkdir sub && + echo original > sub/file && + git add sub/file && + test_tick && + git commit -m initial && + echo newer > sub/file && + test_tick && + git commit -m newer sub/file && + git checkout -b side HEAD^ && + git rm sub/file && + mkdir sub && + (cd sub && + git init && + echo file > file && + git add file && + test_tick && + git commit -m submodule) && + git add sub && + test_tick && + git commit -m with-submodule + +' + +test_expect_failure 'merging with tree/submodule conflict fails' ' + + test_must_fail git merge master && + test -f .git/MERGE_MSG + +' + +test_expect_failure 'the other way round' ' + + git reset --hard && + mv sub submodule && + git checkout -f master && + test_must_fail git merge side && + test -f .git/MERGE_MSG + +' + +# This will be only a failure when the previous tests succeed +test_expect_failure 'checkout from submodule/directory conflict' ' + + git checkout -f -b side2 HEAD^ && + test -z "$(git ls-files --unmerged)" + +' + +test_expect_failure 'merge submodule without changing the directory' ' + + git reset --hard && + echo another > file && + git add file && + test_tick && + git commit -m side2 && + test_must_fail git merge side && + test -f .git/MERGE_MSG + +' + +test_expect_failure 'file/submodule conflict' ' + + git reset --hard && + git rm file && + git mv sub file && + test_tick && + git commit -m side2 && + git checkout -b side3 HEAD^ && + echo yet another > file2 && + git add file2 && + test_tick && + git commit -m side3 && + git merge side2 + +' + +test_done -- 2.11.4.GIT