aboutsummaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-03-17 15:38:05 -0700
committerJunio C Hamano <gitster@pobox.com>2017-03-18 09:51:23 -0700
commit1b614c07d2428927358cc7317622913d1dbd59c9 (patch)
tree93f0bc029aedf7ccba6b861f9b905fcbdab1c0bb /git-submodule.sh
parent1f8d711548c08e05766e067dc23e5be3b1b72657 (diff)
downloadgit-1b614c07d2428927358cc7317622913d1dbd59c9.tar.gz
git-1b614c07d2428927358cc7317622913d1dbd59c9.tar.xz
submodule add: respect submodule.active and submodule.<name>.active
In addition to adding submodule.<name>.url to the config, set submodule.<name>.active to true unless submodule.active is configured and the submodule's path matches the configured pathspec. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index db94dea3b..6ec35e5fc 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -278,6 +278,20 @@ or you are unsure what this means choose another name with the '--name' option."
fi &&
git add --force .gitmodules ||
die "$(eval_gettext "Failed to register submodule '\$sm_path'")"
+
+ # NEEDSWORK: In a multi-working-tree world, this needs to be
+ # set in the per-worktree config.
+ if git config --get submodule.active >/dev/null
+ then
+ # If the submodule being adding isn't already covered by the
+ # current configured pathspec, set the submodule's active flag
+ if ! git submodule--helper is-active "$sm_path"
+ then
+ git config submodule."$sm_name".active "true"
+ fi
+ else
+ git config submodule."$sm_name".active "true"
+ fi
}
#