aboutsummaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-09-20 15:20:42 -0700
committerJunio C Hamano <gitster@pobox.com>2021-09-20 15:20:42 -0700
commitb5a36278f4f3219c1158c7891ba25fe29f5eebf7 (patch)
tree625c2f1198ef2cdfe8b21604b8375a9bb742cb6d /git-submodule.sh
parent67fc02be54bc8f5e8abf381456f297e32440b88a (diff)
parenta452128a36cb73f5366c23eabe93c7edfa227866 (diff)
downloadgit-b5a36278f4f3219c1158c7891ba25fe29f5eebf7.tar.xz
Merge branch 'ar/submodule-add-config'
Large part of "git submodule add" gets rewritten in C. * ar/submodule-add-config: submodule--helper: introduce add-config subcommand
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh28
1 files changed, 1 insertions, 27 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index dbd2ec2050..8c219ef382 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -242,33 +242,7 @@ cmd_add()
fi
git submodule--helper add-clone ${GIT_QUIET:+--quiet} ${force:+"--force"} ${progress:+"--progress"} ${branch:+--branch "$branch"} --prefix "$wt_prefix" --path "$sm_path" --name "$sm_name" --url "$realrepo" ${reference:+"$reference"} ${dissociate:+"--dissociate"} ${depth:+"$depth"} || exit
- git config submodule."$sm_name".url "$realrepo"
-
- git add --no-warn-embedded-repo $force "$sm_path" ||
- die "fatal: $(eval_gettext "Failed to add submodule '\$sm_path'")"
-
- git submodule--helper config submodule."$sm_name".path "$sm_path" &&
- git submodule--helper config submodule."$sm_name".url "$repo" &&
- if test -n "$branch"
- then
- git submodule--helper config submodule."$sm_name".branch "$branch"
- fi &&
- git add --force .gitmodules ||
- die "fatal: $(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 add-config ${force:+--force} ${branch:+--branch "$branch"} --url "$repo" --resolved-url "$realrepo" --path "$sm_path" --name "$sm_name"
}
#