diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-04-18 14:18:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-04-18 14:18:29 -0700 |
commit | f3924858133dff1e94c992b689fa425a6d27d4fd (patch) | |
tree | f36c23d1e0f411e29f2b265e247977cedac01e71 /t | |
parent | Merge branch 'cb/maint-merge-recursive-submodule-fix' into maint (diff) | |
parent | Fix 'git checkout <submodule>' to update the index (diff) | |
download | tgif-f3924858133dff1e94c992b689fa425a6d27d4fd.tar.xz |
Merge branch 'js/maint-submodule-checkout' into maint
* js/maint-submodule-checkout:
Fix 'git checkout <submodule>' to update the index
Diffstat (limited to 't')
-rwxr-xr-x | t/t2013-checkout-submodule.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/t/t2013-checkout-submodule.sh b/t/t2013-checkout-submodule.sh new file mode 100755 index 0000000000..fda3f0af7e --- /dev/null +++ b/t/t2013-checkout-submodule.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +test_description='checkout can handle submodules' + +. ./test-lib.sh + +test_expect_success 'setup' ' + mkdir submodule && + (cd submodule && + git init && + test_commit first) && + git add submodule && + test_tick && + git commit -m superproject && + (cd submodule && + test_commit second) && + git add submodule && + test_tick && + git commit -m updated.superproject +' + +test_expect_success '"reset <submodule>" updates the index' ' + git update-index --refresh && + git diff-files --quiet && + git diff-index --quiet --cached HEAD && + test_must_fail git reset HEAD^ submodule && + test_must_fail git diff-files --quiet && + git reset submodule && + git diff-files --quiet +' + +test_expect_success '"checkout <submodule>" updates the index only' ' + git update-index --refresh && + git diff-files --quiet && + git diff-index --quiet --cached HEAD && + git checkout HEAD^ submodule && + test_must_fail git diff-files --quiet && + git checkout HEAD submodule && + git diff-files --quiet +' + +test_done |