aboutsummaryrefslogtreecommitdiff
path: root/t/lib-submodule-update.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2014-06-15 19:01:41 +0200
committerJunio C Hamano <gitster@pobox.com>2014-07-14 12:06:15 -0700
commit663ed39a889dae8beee2fc6953607f7660a5cddf (patch)
treecc0c59421dd5c7977f1fa9210e5506dff096c746 /t/lib-submodule-update.sh
parent8f8ba56b5b6321b07eba29bb7ae6a94b5ae0d34a (diff)
downloadgit-663ed39a889dae8beee2fc6953607f7660a5cddf.tar.gz
git-663ed39a889dae8beee2fc6953607f7660a5cddf.tar.xz
merge: add t7613 for submodule updates
Test that the merge command updates the work tree as expected (for submodule changes which don't result in conflicts) when used without arguments or with the '--ff', '--ff-only' and '--no-ff' flag. Implement the KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR switch to expect the known failure that --no-ff merges do not create the empty submodule directory. The KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES switch is also implemented to expect the known failure that --no-ff merges attempt to merge the new files in the former submodule directory with those of the removed submodule. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-submodule-update.sh')
-rwxr-xr-xt/lib-submodule-update.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index f2e58eb90..759dbe614 100755
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -285,7 +285,16 @@ test_submodule_switch () {
'
# ... as does removing a directory with tracked files with a
# submodule.
- test_expect_success "$command: replace directory with submodule" '
+ if test "$KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR" = 1
+ then
+ # Non fast-forward merges fail with "Directory sub1 doesn't
+ # exist. sub1" because the empty submodule directory is not
+ # created
+ RESULT="failure"
+ else
+ RESULT="success"
+ fi
+ test_expect_$RESULT "$command: replace directory with submodule" '
prolog &&
reset_work_tree_to replace_sub1_with_directory &&
(
@@ -328,7 +337,16 @@ test_submodule_switch () {
'
# Replacing a submodule with files in a directory must fail as the
# submodule work tree isn't removed ...
- test_expect_success "$command: replace submodule with a directory must fail" '
+ if test "$KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES" = 1
+ then
+ # Non fast-forward merges attempt to merge the former
+ # submodule files with the newly checked out ones in the
+ # directory of the same name while it shouldn't.
+ RESULT="failure"
+ else
+ RESULT="success"
+ fi
+ test_expect_$RESULT "$command: replace submodule with a directory must fail" '
prolog &&
reset_work_tree_to add_sub1 &&
(
@@ -340,7 +358,7 @@ test_submodule_switch () {
)
'
# ... especially when it contains a .git directory.
- test_expect_success "$command: replace submodule containing a .git directory with a directory must fail" '
+ test_expect_$RESULT "$command: replace submodule containing a .git directory with a directory must fail" '
prolog &&
reset_work_tree_to add_sub1 &&
(