git-fetch --tags: reject malformed tags.

When the other end was prepared with older git and has tags that
do not follow the naming convention (see check-ref-format), do not
barf but simply reject to copy them.

Initial fix by Simon Richter, but done differently.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-01-05 19:42:12 -08:00
parent 353ce81597
commit 81214e4ddf

View File

@ -188,11 +188,20 @@ esac
reflist=$(get_remote_refs_for_fetch "$@") reflist=$(get_remote_refs_for_fetch "$@")
if test "$tags" if test "$tags"
then then
taglist=$(git-ls-remote --tags "$remote" | taglist=$(IFS=" " &&
sed -e ' git-ls-remote --tags "$remote" |
/\^/d while read sha1 name
s/^[^ ]* // do
s/.*/.&:&/') case "$name" in
(*^*) continue ;;
esac
if git-check-ref-format "$name"
then
echo ".${name}:${name}"
else
echo >&2 "warning: tag ${name} ignored"
fi
done)
if test "$#" -gt 1 if test "$#" -gt 1
then then
# remote URL plus explicit refspecs; we need to merge them. # remote URL plus explicit refspecs; we need to merge them.