From: Junio C Hamano Date: Mon, 2 May 2011 22:58:36 +0000 (-0700) Subject: Merge branch 'nm/submodule-update-force' X-Git-Tag: v1.7.6-rc0~124 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0d405d72f5ffb499b40dd3a95886ae5a1fc13b30;p=git.git Merge branch 'nm/submodule-update-force' * nm/submodule-update-force: submodule: Add --force option for git submodule update Conflicts: t/t7406-submodule-update.sh --- 0d405d72f5ffb499b40dd3a95886ae5a1fc13b30 diff --cc t/t7406-submodule-update.sh index bf7c78873,5d24d9ff7..4f16fcce2 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@@ -74,26 -74,29 +74,49 @@@ test_expect_success 'submodule update d ) ' +apos="'"; +test_expect_success 'submodule update does not fetch already present commits' ' + (cd submodule && + echo line3 >> file && + git add file && + test_tick && + git commit -m "upstream line3" + ) && + (cd super/submodule && + head=$(git rev-parse --verify HEAD) && + echo "Submodule path ${apos}submodule$apos: checked out $apos$head$apos" > ../../expected && + git reset --hard HEAD~1 + ) && + (cd super && + git submodule update > ../actual 2> ../actual.err + ) && + test_cmp expected actual && + ! 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