summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorLibravatar Glen Choo <chooglen@google.com>2022-03-04 16:13:55 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-03-04 16:39:12 -0800
commit1012a5cbc3fe4bcfae278a8103e60054d2674784 (patch)
tree62d02906ea63b176eb573409d1acca9dd1c79a9f /git-submodule.sh
parentsubmodule--helper: don't use bitfield indirection for parse_options() (diff)
downloadtgif-1012a5cbc3fe4bcfae278a8103e60054d2674784.tar.xz
submodule--helper run-update-procedure: learn --remote
Teach run-update-procedure to handle --remote instead of parsing --remote in git-submodule.sh. As a result, "git submodule--helper [print-default-remote|remote-branch]" have no more callers, so remove them. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh30
1 files changed, 1 insertions, 29 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 32a09302ab..882bf097d5 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -247,20 +247,6 @@ cmd_deinit()
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit ${GIT_QUIET:+--quiet} ${force:+--force} ${deinit_all:+--all} -- "$@"
}
-# usage: fetch_in_submodule <module_path> [<depth>] [<sha1>]
-# Because arguments are positional, use an empty string to omit <depth>
-# but include <sha1>.
-fetch_in_submodule () (
- sanitize_submodule_env &&
- cd "$1" &&
- if test $# -eq 3
- then
- echo "$3" | git fetch ${GIT_QUIET:+--quiet} --stdin ${2:+"$2"}
- else
- git fetch ${GIT_QUIET:+--quiet} ${2:+"$2"}
- fi
-)
-
#
# Update each submodule path to correct revision, using clone and checkout as needed
#
@@ -411,21 +397,6 @@ cmd_update()
just_cloned=
fi
- if test -n "$remote"
- then
- branch=$(git submodule--helper remote-branch "$sm_path")
- if test -z "$nofetch"
- then
- # Fetch remote before determining tracking $sha1
- fetch_in_submodule "$sm_path" $depth ||
- die "fatal: $(eval_gettext "Unable to fetch in submodule path '\$sm_path'")"
- fi
- remote_name=$(sanitize_submodule_env; cd "$sm_path" && git submodule--helper print-default-remote)
- sha1=$(sanitize_submodule_env; cd "$sm_path" &&
- git rev-parse --verify "${remote_name}/${branch}") ||
- die "fatal: $(eval_gettext "Unable to find current \${remote_name}/\${branch} revision in submodule path '\$sm_path'")"
- fi
-
out=$(git submodule--helper run-update-procedure \
${wt_prefix:+--prefix "$wt_prefix"} \
${GIT_QUIET:+--quiet} \
@@ -436,6 +407,7 @@ cmd_update()
${update:+--update "$update"} \
${prefix:+--recursive-prefix "$prefix"} \
${sha1:+--oid "$sha1"} \
+ ${remote:+--remote} \
"--" \
"$sm_path")