Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-03-18 01:38:02 +0300
committerJunio C Hamano <gitster@pobox.com>2017-03-18 19:51:23 +0300
commit3e7eaed016e6241e96de6a0140923e81cfc387e8 (patch)
treee3bfda65b4bce0381f37830b20568b51b195aec4 /t/t7400-submodule-basic.sh
parenta086f921a725319a6f0c2c3aacf676c890b3ce3e (diff)
submodule init: initialize active submodules
Teach `submodule init` to initialize submodules which have been configured to be active by setting 'submodule.active' with a pathspec. Now if no path arguments are given and 'submodule.active' is configured, `init` will initialize all submodules which have been configured to be active. If no path arguments are given and 'submodule.active' is not configured, then `init` will retain the old behavior of initializing all submodules. This allows users to record more complex patterns as it saves retyping them whenever you invoke update. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7400-submodule-basic.sh')
-rwxr-xr-xt/t7400-submodule-basic.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index c09ce0d4c1..fbbe932d1f 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -1130,5 +1130,62 @@ test_expect_success 'submodule helper list is not confused by common prefixes' '
test_cmp expect actual
'
+test_expect_success 'setup superproject with submodules' '
+ git init sub1 &&
+ test_commit -C sub1 test &&
+ test_commit -C sub1 test2 &&
+ git init multisuper &&
+ git -C multisuper submodule add ../sub1 sub0 &&
+ git -C multisuper submodule add ../sub1 sub1 &&
+ git -C multisuper submodule add ../sub1 sub2 &&
+ git -C multisuper submodule add ../sub1 sub3 &&
+ git -C multisuper commit -m "add some submodules"
+'
+
+cat >expect <<-EOF
+-sub0
+ sub1 (test2)
+ sub2 (test2)
+ sub3 (test2)
+EOF
+
+test_expect_success 'submodule update --init with a specification' '
+ test_when_finished "rm -rf multisuper_clone" &&
+ pwd=$(pwd) &&
+ git clone file://"$pwd"/multisuper multisuper_clone &&
+ git -C multisuper_clone submodule update --init . ":(exclude)sub0" &&
+ git -C multisuper_clone submodule status |cut -c 1,43- >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'submodule update --init with submodule.active set' '
+ test_when_finished "rm -rf multisuper_clone" &&
+ pwd=$(pwd) &&
+ git clone file://"$pwd"/multisuper multisuper_clone &&
+ git -C multisuper_clone config submodule.active "." &&
+ git -C multisuper_clone config --add submodule.active ":(exclude)sub0" &&
+ git -C multisuper_clone submodule update --init &&
+ git -C multisuper_clone submodule status |cut -c 1,43- >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'submodule update and setting submodule.<name>.active' '
+ test_when_finished "rm -rf multisuper_clone" &&
+ pwd=$(pwd) &&
+ git clone file://"$pwd"/multisuper multisuper_clone &&
+ git -C multisuper_clone config --bool submodule.sub0.active "true" &&
+ git -C multisuper_clone config --bool submodule.sub1.active "false" &&
+ git -C multisuper_clone config --bool submodule.sub2.active "true" &&
+
+ cat >expect <<-\EOF &&
+ sub0 (test2)
+ -sub1
+ sub2 (test2)
+ -sub3
+ EOF
+ git -C multisuper_clone submodule update &&
+ git -C multisuper_clone submodule status |cut -c 1,43- >actual &&
+ test_cmp expect actual
+'
test_done