summaryrefslogtreecommitdiff
path: root/t/t7406-submodule-update.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-02 15:58:36 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-02 15:58:36 -0700
commit0d405d72f5ffb499b40dd3a95886ae5a1fc13b30 (patch)
tree5508dff285aa24e08475eae9b2d7380800881e45 /t/t7406-submodule-update.sh
parent2d23c64ba2e91029f4ce932117a1772378d63cf3 (diff)
parent9db31bdf5c834689c826f809d6d15bf7ab8d3598 (diff)
downloadgit-0d405d72f5ffb499b40dd3a95886ae5a1fc13b30.tar.gz
Merge branch 'nm/submodule-update-force'
* nm/submodule-update-force: submodule: Add --force option for git submodule update Conflicts: t/t7406-submodule-update.sh
Diffstat (limited to 't/t7406-submodule-update.sh')
-rwxr-xr-xt/t7406-submodule-update.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index bf7c788735..4f16fcce2b 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -94,6 +94,29 @@ test_expect_success 'submodule update does not fetch already present commits' '
! test -s actual.err
'
+test_expect_success 'submodule update should fail due to local changes' '
+ (cd super/submodule &&
+ git reset --hard HEAD~1 &&
+ echo "local change" > file
+ ) &&
+ (cd super &&
+ (cd submodule &&
+ compare_head
+ ) &&
+ test_must_fail git submodule update submodule
+ )
+'
+test_expect_success 'submodule update should throw away changes with --force ' '
+ (cd super &&
+ (cd submodule &&
+ compare_head
+ ) &&
+ git submodule update --force submodule &&
+ cd submodule &&
+ ! compare_head
+ )
+'
+
test_expect_success 'submodule update --rebase staying on master' '
(cd super/submodule &&
git checkout master