Signed-off-by: Stefan Beller <sbel...@google.com>
---
 git-submodule.sh           |  6 +++++-
 t/t7400-submodule-basic.sh | 21 +++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index bbdcf78..4092a48 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -455,6 +455,7 @@ cmd_foreach()
 #
 cmd_init()
 {
+       submodule_groups=
        # parse $args after "submodule ... init".
        while test $# -ne 0
        do
@@ -462,6 +463,9 @@ cmd_init()
                -q|--quiet)
                        GIT_QUIET=1
                        ;;
+               -g|--groups)
+                       submodule_groups=1
+                       ;;
                --)
                        shift
                        break
@@ -476,7 +480,7 @@ cmd_init()
                shift
        done
 
-       git submodule--helper list --prefix "$wt_prefix" "$@" |
+       git submodule--helper list ${submodule_groups:+--groups} --prefix 
"$wt_prefix" "$@" |
        while read mode sha1 stage sm_path
        do
                die_if_unmatched "$mode"
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index a422df3..caed4be 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -1028,4 +1028,25 @@ test_expect_success 'submodule add records groups' '
        )
 '
 
+test_expect_success 'submodule init --group works' '
+       test_when_finished "rm -rf super super_clone" &&
+       mkdir super &&
+       pwd=$(pwd) &&
+       (
+               cd super &&
+               git init &&
+               git submodule add --group groupA file://"$pwd"/example2 
submodule &&
+               git submodule add file://"$pwd"/example2 submodule1 &&
+               git commit -a -m "create repository with 2 submodules, one is 
in a group"
+       ) &&
+       git clone super super_clone &&
+       (
+               cd super_clone &&
+               git config submodule.groups groupA &&
+               git submodule init --groups &&
+               git config submodule.submodule.url &&
+               test_must_fail git config submodule.submodule1.url
+       )
+'
+
 test_done
-- 
2.6.1.261.g0d9c4c1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to