X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7406-submodule-update.sh;h=4f16fcce2bfcb63f437fa6b495fdb5c4370fccc1;hb=ac13e7c514d6790cc59041545f26b3f5da543b25;hp=bf7c788735d6e3e0ecf56e7a2f82826701ee1789;hpb=d98a509ec3e9ff22bb642f778900691d0c715ba9;p=git.git diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index bf7c78873..4f16fcce2 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