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
}
#
git submodule--helper list --prefix "$wt_prefix" ||
echo "#unmatched" $?
} |
- while read mode sha1 stage sm_path
+ while read -r mode sha1 stage sm_path
do
die_if_unmatched "$mode" "$sha1"
if test -e "$sm_path"/.git
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched" $?
} |
- while read mode sha1 stage sm_path
+ while read -r mode sha1 stage sm_path
do
die_if_unmatched "$mode" "$sha1"
name=$(git submodule--helper name "$sm_path") || exit
"$@" || echo "#unmatched" $?
} | {
err=
- while read mode sha1 stage just_cloned sm_path
+ while read -r mode sha1 stage just_cloned sm_path
do
die_if_unmatched "$mode" "$sha1"
# Get modified modules cared by user
modules=$(git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- "$@" |
sane_egrep '^:([0-7]* )?160000' |
- while read mod_src mod_dst sha1_src sha1_dst status sm_path
+ while read -r mod_src mod_dst sha1_src sha1_dst status sm_path
do
# Always show modules deleted or type-changed (blob<->module)
if test "$status" = D || test "$status" = T
git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- $modules |
sane_egrep '^:([0-7]* )?160000' |
cut -c2- |
- while read mod_src mod_dst sha1_src sha1_dst status name
+ while read -r mod_src mod_dst sha1_src sha1_dst status name
do
if test -z "$cached" &&
test $sha1_dst = 0000000000000000000000000000000000000000
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched" $?
} |
- while read mode sha1 stage sm_path
+ while read -r mode sha1 stage sm_path
do
die_if_unmatched "$mode" "$sha1"
name=$(git submodule--helper name "$sm_path") || exit
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched" $?
} |
- while read mode sha1 stage sm_path
+ while read -r mode sha1 stage sm_path
do
die_if_unmatched "$mode" "$sha1"
- name=$(git submodule--helper name "$sm_path")
# skip inactive submodules
- if ! git config "submodule.$name.url" >/dev/null 2>/dev/null
+ if ! git submodule--helper is-active "$sm_path"
then
continue
fi
+ name=$(git submodule--helper name "$sm_path")
url=$(git config -f .gitmodules --get submodule."$name".url)
# Possibly a url relative to parent