зеркало из https://github.com/microsoft/git.git
submodules: print "registered for path" message only once
Since2cd9de3e
(submodule add: always initialize .git/config entry) the message "Submodule '\$name' (\$url) registered for path '\$sm_path'" is printed every time cmd_init() is called, e.g. each time "git submodule update" is used with the --init option. This was not intended and leads to bogus output which can confuse users and build systems. Apart from that the $url variable was not set after the first run which did the actual initialization and only "()" was printed in subsequent runs where "($url)" was meant to inform the user about the upstream repo. Fix that by moving the say command in question into the if block where the url is initialized, restoring the behavior that was in place before the2cd9de3e
commit. While at it also remove the comment which still describes the logic used before2cd9de3e
and add a comment about how things work now. Reported-by: Nicolas Viennot and Sid Nair <nicolas@viennot.com> Reported-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
befc5ed379
Коммит
c1c259e225
|
@ -396,8 +396,9 @@ cmd_init()
|
||||||
module_list "$@" |
|
module_list "$@" |
|
||||||
while read mode sha1 stage sm_path
|
while read mode sha1 stage sm_path
|
||||||
do
|
do
|
||||||
# Skip already registered paths
|
|
||||||
name=$(module_name "$sm_path") || exit
|
name=$(module_name "$sm_path") || exit
|
||||||
|
|
||||||
|
# Copy url setting when it is not set yet
|
||||||
if test -z "$(git config "submodule.$name.url")"
|
if test -z "$(git config "submodule.$name.url")"
|
||||||
then
|
then
|
||||||
url=$(git config -f .gitmodules submodule."$name".url)
|
url=$(git config -f .gitmodules submodule."$name".url)
|
||||||
|
@ -412,6 +413,8 @@ cmd_init()
|
||||||
esac
|
esac
|
||||||
git config submodule."$name".url "$url" ||
|
git config submodule."$name".url "$url" ||
|
||||||
die "$(eval_gettext "Failed to register url for submodule path '\$sm_path'")"
|
die "$(eval_gettext "Failed to register url for submodule path '\$sm_path'")"
|
||||||
|
|
||||||
|
say "$(eval_gettext "Submodule '\$name' (\$url) registered for path '\$sm_path'")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy "update" setting when it is not set yet
|
# Copy "update" setting when it is not set yet
|
||||||
|
@ -420,8 +423,6 @@ cmd_init()
|
||||||
test -n "$(git config submodule."$name".update)" ||
|
test -n "$(git config submodule."$name".update)" ||
|
||||||
git config submodule."$name".update "$upd" ||
|
git config submodule."$name".update "$upd" ||
|
||||||
die "$(eval_gettext "Failed to register update mode for submodule path '\$sm_path'")"
|
die "$(eval_gettext "Failed to register update mode for submodule path '\$sm_path'")"
|
||||||
|
|
||||||
say "$(eval_gettext "Submodule '\$name' (\$url) registered for path '\$sm_path'")"
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче