path: root/t/
diff options
authorJohan Herland <>2009-08-19 01:45:24 (GMT)
committerJunio C Hamano <>2009-08-19 05:59:58 (GMT)
commit64b19ffeddda499e7380b38b43a3dee579734905 (patch)
treefb9c4e3036fdf0e8fbed34e934431a9b38201dca /t/
parentb13fd5c1a2bd450cdf7b853e0c4861f361882a18 (diff)
git submodule status: Add --recursive to recurse into nested submodules
In very large and hierarchically structured projects, one may encounter nested submodules. In these situations, it is valuable to not only show status for all the submodules in the current repo (which is what is currently done by 'git submodule status'), but also to show status for all submodules at all levels (i.e. recursing into nested submodules as well). This patch teaches the new --recursive option to the 'git submodule status' command. The patch also includes documentation and selftests. Signed-off-by: Johan Herland <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 26 insertions, 0 deletions
diff --git a/t/ b/t/
index 9122bfe..de1730d 100755
--- a/t/
+++ b/t/
@@ -194,4 +194,30 @@ test_expect_success 'use "update --recursive" to checkout all submodules' '
+nested1sha1=$(cd clone3/nested1 && git rev-parse HEAD)
+nested2sha1=$(cd clone3/nested1/nested2 && git rev-parse HEAD)
+nested3sha1=$(cd clone3/nested1/nested2/nested3 && git rev-parse HEAD)
+submodulesha1=$(cd clone3/nested1/nested2/nested3/submodule && git rev-parse HEAD)
+sub1sha1=$(cd clone3/sub1 && git rev-parse HEAD)
+sub2sha1=$(cd clone3/sub2 && git rev-parse HEAD)
+sub3sha1=$(cd clone3/sub3 && git rev-parse HEAD)
+cat > expect <<EOF
+ $nested1sha1 nested1 (heads/master)
+ $nested2sha1 nested1/nested2 (heads/master)
+ $nested3sha1 nested1/nested2/nested3 (heads/master)
+ $submodulesha1 nested1/nested2/nested3/submodule (heads/master)
+ $sub1sha1 sub1 (${sub1sha1:0:7})
+ $sub2sha1 sub2 (${sub1sha1:0:7})
+ $sub3sha1 sub3 (heads/master)
+test_expect_success 'test "status --recursive"' '
+ (
+ cd clone3 &&
+ git submodule status --recursive > ../actual
+ ) &&
+ test_cmp expect actual