Merge branch 'sb/submodule-parallel-update'
A major part of "git submodule update" has been ported to C to take advantage of the recently added framework to run download tasks in parallel. * sb/submodule-parallel-update: clone: allow an explicit argument for parallel submodule clones submodule update: expose parallelism to the user submodule helper: remove double 'fatal: ' prefix git submodule update: have a dedicated helper for cloning run_processes_parallel: rename parameters for the callbacks run_processes_parallel: treat output of children as byte array submodule update: direct error message to stderr fetching submodules: respect `submodule.fetchJobs` config option submodule-config: drop check against NULL submodule-config: keep update strategy around
This commit is contained in:
@ -663,6 +663,14 @@ cmd_update()
|
||||
--depth=*)
|
||||
depth=$1
|
||||
;;
|
||||
-j|--jobs)
|
||||
case "$2" in '') usage ;; esac
|
||||
jobs="--jobs=$2"
|
||||
shift
|
||||
;;
|
||||
--jobs=*)
|
||||
jobs=$1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@ -682,17 +690,21 @@ cmd_update()
|
||||
cmd_init "--" "$@" || return
|
||||
fi
|
||||
|
||||
cloned_modules=
|
||||
git submodule--helper list --prefix "$wt_prefix" "$@" | {
|
||||
{
|
||||
git submodule--helper update-clone ${GIT_QUIET:+--quiet} \
|
||||
${wt_prefix:+--prefix "$wt_prefix"} \
|
||||
${prefix:+--recursive-prefix "$prefix"} \
|
||||
${update:+--update "$update"} \
|
||||
${reference:+--reference "$reference"} \
|
||||
${depth:+--depth "$depth"} \
|
||||
${jobs:+$jobs} \
|
||||
"$@" || echo "#unmatched"
|
||||
} | {
|
||||
err=
|
||||
while read mode sha1 stage sm_path
|
||||
while read mode sha1 stage just_cloned sm_path
|
||||
do
|
||||
die_if_unmatched "$mode"
|
||||
if test "$stage" = U
|
||||
then
|
||||
echo >&2 "Skipping unmerged submodule $prefix$sm_path"
|
||||
continue
|
||||
fi
|
||||
|
||||
name=$(git submodule--helper name "$sm_path") || exit
|
||||
url=$(git config submodule."$name".url)
|
||||
branch=$(get_submodule_config "$name" branch master)
|
||||
@ -709,27 +721,10 @@ cmd_update()
|
||||
|
||||
displaypath=$(relative_path "$prefix$sm_path")
|
||||
|
||||
if test "$update_module" = "none"
|
||||
if test $just_cloned -eq 1
|
||||
then
|
||||
echo "Skipping submodule '$displaypath'"
|
||||
continue
|
||||
fi
|
||||
|
||||
if test -z "$url"
|
||||
then
|
||||
# Only mention uninitialized submodules when its
|
||||
# path have been specified
|
||||
test "$#" != "0" &&
|
||||
say "$(eval_gettext "Submodule path '\$displaypath' not initialized
|
||||
Maybe you want to use 'update --init'?")"
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! test -d "$sm_path"/.git && ! test -f "$sm_path"/.git
|
||||
then
|
||||
git submodule--helper clone ${GIT_QUIET:+--quiet} --prefix "$prefix" --path "$sm_path" --name "$name" --url "$url" "$reference" "$depth" || exit
|
||||
cloned_modules="$cloned_modules;$name"
|
||||
subsha1=
|
||||
update_module=checkout
|
||||
else
|
||||
subsha1=$(clear_local_git_env; cd "$sm_path" &&
|
||||
git rev-parse --verify HEAD) ||
|
||||
@ -774,13 +769,6 @@ Maybe you want to use 'update --init'?")"
|
||||
die "$(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain $sha1. Direct fetching of that commit failed.")"
|
||||
fi
|
||||
|
||||
# Is this something we just cloned?
|
||||
case ";$cloned_modules;" in
|
||||
*";$name;"*)
|
||||
# then there is no local change to integrate
|
||||
update_module=checkout ;;
|
||||
esac
|
||||
|
||||
must_die_on_failure=
|
||||
case "$update_module" in
|
||||
checkout)
|
||||
|
||||
Reference in New Issue
Block a user