From c1a3c3640deb8bd6929026a55b18feb1dda74e77 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Thu, 11 Nov 2010 00:55:41 +0100 Subject: Submodules: Add the "fetchRecurseSubmodules" config option The new boolean "fetchRecurseSubmodules" config option controls the behavior for "git fetch" and "git pull". It specifies if these commands should recurse into submodules and fetch new commits there too and can be set separately for each submodule. In the .gitmodules file "submodule..fetchRecurseSubmodules" entries are read before looking for them in .git/config. Thus settings found in .git/config will override those from .gitmodules, thereby allowing the user to ignore settings given by the remote side while also letting upstream set reasonable defaults for those users who don't have special needs. This configuration can be overridden by the command line option "--[no-]recurse-submodules" of "git fetch" and "git pull". Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano --- t/t5526-fetch-submodules.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 't') diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh index 71e2a66f3b..884a5e567c 100755 --- a/t/t5526-fetch-submodules.sh +++ b/t/t5526-fetch-submodules.sh @@ -81,6 +81,56 @@ test_expect_success "fetch alone only fetches superproject" ' ! test -s actual.err ' +test_expect_success "fetch --no-recurse-submodules only fetches superproject" ' + ( + cd downstream && + git fetch --no-recurse-submodules >../actual.out 2>../actual.err + ) && + ! test -s actual.out && + ! test -s actual.err +' + +test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" ' + ( + cd downstream && + git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true && + git fetch >../actual.out 2>../actual.err + ) && + test_cmp expect.out actual.out && + test_cmp expect.err actual.err +' + +test_expect_success "--no-recurse-submodules overrides .gitmodules config" ' + add_upstream_commit && + ( + cd downstream && + git fetch --no-recurse-submodules >../actual.out 2>../actual.err + ) && + ! test -s actual.out && + ! test -s actual.err +' + +test_expect_success "using fetchRecurseSubmodules=false in .git/config overrides setting in .gitmodules" ' + ( + cd downstream && + git config submodule.submodule.fetchRecurseSubmodules false && + git fetch >../actual.out 2>../actual.err + ) && + ! test -s actual.out && + ! test -s actual.err +' + +test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config" ' + ( + cd downstream && + git fetch --recurse-submodules >../actual.out 2>../actual.err && + git config -f --unset .gitmodules submodule.submodule.fetchRecurseSubmodules true && + git config --unset submodule.submodule.fetchRecurseSubmodules + ) && + test_cmp expect.out actual.out && + test_cmp expect.err actual.err +' + test_expect_success "--quiet propagates to submodules" ' ( cd downstream && -- cgit v1.2.3