From b13fd5c1a2bd450cdf7b853e0c4861f361882a18 Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Wed, 19 Aug 2009 03:45:23 +0200 Subject: git submodule update: Introduce --recursive to update nested submodules In very large and hierarchically structured projects, one may encounter nested submodules. In these situations, it is valuable to not only update the submodules in the current repo (which is what is currently done by 'git submodule update'), but also to operate on all submodules at all levels (i.e. recursing into nested submodules as well). This patch teaches the new --recursive option to the 'git submodule update' command. The patch also includes documentation and selftests. Signed-off-by: Johan Herland Signed-off-by: Junio C Hamano --- t/t7407-submodule-foreach.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 't/t7407-submodule-foreach.sh') diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh index be122c7f8c..9122bfef35 100755 --- a/t/t7407-submodule-foreach.sh +++ b/t/t7407-submodule-foreach.sh @@ -175,4 +175,23 @@ test_expect_success 'test "foreach --quiet --recursive"' ' test_cmp expect actual ' +test_expect_success 'use "update --recursive" to checkout all submodules' ' + git clone super clone3 && + ( + cd clone3 && + test ! -d sub1/.git && + test ! -d sub2/.git && + test ! -d sub3/.git && + test ! -d nested1/.git && + git submodule update --init --recursive && + test -d sub1/.git && + test -d sub2/.git && + test -d sub3/.git && + test -d nested1/.git && + test -d nested1/nested2/.git && + test -d nested1/nested2/nested3/.git && + test -d nested1/nested2/nested3/submodule/.git + ) +' + test_done -- cgit v1.2.3