From: Junio C Hamano Date: Wed, 8 Apr 2009 05:33:02 +0000 (-0700) Subject: Merge branch 'js/maint-submodule-checkout' X-Git-Tag: v1.6.3-rc0~24 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a9906723b23b058cffadaf5db9d87b67384c60c3?hp=2149e0f6a66cb4a5707ef6201763051d94f288af Merge branch 'js/maint-submodule-checkout' * js/maint-submodule-checkout: Fix 'git checkout ' to update the index --- diff --git a/builtin-checkout.c b/builtin-checkout.c index 33d1fecb62..2e4fe1a453 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -53,9 +53,6 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen, int len; struct cache_entry *ce; - if (S_ISGITLINK(mode)) - return 0; - if (S_ISDIR(mode)) return READ_TREE_RECURSIVE; 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 " 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 " 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