submodule sync: skip work for inactive submodules
Sync does some work determining what URLs should be used for a submodule but then throws this work away if the submodule isn't active. Instead perform the activity check earlier and skip inactive submodule in order to avoid doing unnecessary work. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
6dc9f01f33
commit
e7849a9677
|
@ -1090,6 +1090,13 @@ cmd_sync()
|
||||||
do
|
do
|
||||||
die_if_unmatched "$mode" "$sha1"
|
die_if_unmatched "$mode" "$sha1"
|
||||||
name=$(git submodule--helper name "$sm_path")
|
name=$(git submodule--helper name "$sm_path")
|
||||||
|
|
||||||
|
# skip inactive submodules
|
||||||
|
if ! git config "submodule.$name.url" >/dev/null 2>/dev/null
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
url=$(git config -f .gitmodules --get submodule."$name".url)
|
url=$(git config -f .gitmodules --get submodule."$name".url)
|
||||||
|
|
||||||
# Possibly a url relative to parent
|
# Possibly a url relative to parent
|
||||||
|
@ -1111,27 +1118,24 @@ cmd_sync()
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if git config "submodule.$name.url" >/dev/null 2>/dev/null
|
displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
|
||||||
|
say "$(eval_gettext "Synchronizing submodule url for '\$displaypath'")"
|
||||||
|
git config submodule."$name".url "$super_config_url"
|
||||||
|
|
||||||
|
if test -e "$sm_path"/.git
|
||||||
then
|
then
|
||||||
displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix")
|
(
|
||||||
say "$(eval_gettext "Synchronizing submodule url for '\$displaypath'")"
|
sanitize_submodule_env
|
||||||
git config submodule."$name".url "$super_config_url"
|
cd "$sm_path"
|
||||||
|
remote=$(get_default_remote)
|
||||||
|
git config remote."$remote".url "$sub_origin_url"
|
||||||
|
|
||||||
if test -e "$sm_path"/.git
|
if test -n "$recursive"
|
||||||
then
|
then
|
||||||
(
|
prefix="$prefix$sm_path/"
|
||||||
sanitize_submodule_env
|
eval cmd_sync
|
||||||
cd "$sm_path"
|
|
||||||
remote=$(get_default_remote)
|
|
||||||
git config remote."$remote".url "$sub_origin_url"
|
|
||||||
|
|
||||||
if test -n "$recursive"
|
|
||||||
then
|
|
||||||
prefix="$prefix$sm_path/"
|
|
||||||
eval cmd_sync
|
|
||||||
fi
|
|
||||||
)
|
|
||||||
fi
|
fi
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue