summaryrefslogtreecommitdiff
path: root/t/lib-submodule-update.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2014-06-19 22:12:54 +0200
committerJunio C Hamano <gitster@pobox.com>2014-07-14 12:06:16 -0700
commitda7fe3fb6d810507bef586e76a01bb34758d4472 (patch)
treed793ca7dd731958d727be4a2de7e804b6081febd /t/lib-submodule-update.sh
parent23e2f388c7da3cfe72c880e662dafb0c2965abba (diff)
downloadgit-da7fe3fb6d810507bef586e76a01bb34758d4472.tar.gz
stash: add t3906 for submodule updates
Test that the stash apply command updates the work tree as expected for changes which don't result in conflicts. To make that work add a helper function that uses read-tree to apply the changes of the target commit to the work tree, then stashes these changes and at last applies that stash. Implement the KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES switch and reuse two other already present switches to expect the known failure that stash does ignore submodule changes. 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.sh23
1 files changed, 18 insertions, 5 deletions
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index d499b2752e..79cdd34a54 100755
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -227,7 +227,14 @@ test_submodule_switch () {
command="$1"
######################### Appearing submodule #########################
# Switching to a commit letting a submodule appear creates empty dir ...
- test_expect_success "$command: added submodule creates empty directory" '
+ if test "$KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES" = 1
+ then
+ # Restoring stash fails to restore submodule index entry
+ RESULT="failure"
+ else
+ RESULT="success"
+ fi
+ test_expect_$RESULT "$command: added submodule creates empty directory" '
prolog &&
reset_work_tree_to no_submodule &&
(
@@ -241,7 +248,7 @@ test_submodule_switch () {
)
'
# ... and doesn't care if it already exists ...
- test_expect_success "$command: added submodule leaves existing empty directory alone" '
+ test_expect_$RESULT "$command: added submodule leaves existing empty directory alone" '
prolog &&
reset_work_tree_to no_submodule &&
(
@@ -270,7 +277,7 @@ test_submodule_switch () {
'
# Replacing a tracked file with a submodule produces an empty
# directory ...
- test_expect_success "$command: replace tracked file with submodule creates empty directory" '
+ test_expect_$RESULT "$command: replace tracked file with submodule creates empty directory" '
prolog &&
reset_work_tree_to replace_sub1_with_file &&
(
@@ -310,7 +317,13 @@ test_submodule_switch () {
######################## Disappearing submodule #######################
# Removing a submodule doesn't remove its work tree ...
- test_expect_success "$command: removed submodule leaves submodule directory and its contents in place" '
+ if test "$KNOWN_FAILURE_STASH_DOES_IGNORE_SUBMODULE_CHANGES" = 1
+ then
+ RESULT="failure"
+ else
+ RESULT="success"
+ fi
+ test_expect_$RESULT "$command: removed submodule leaves submodule directory and its contents in place" '
prolog &&
reset_work_tree_to add_sub1 &&
(
@@ -322,7 +335,7 @@ test_submodule_switch () {
)
'
# ... especially when it contains a .git directory.
- test_expect_success "$command: removed submodule leaves submodule containing a .git directory alone" '
+ test_expect_$RESULT "$command: removed submodule leaves submodule containing a .git directory alone" '
prolog &&
reset_work_tree_to add_sub1 &&
(