aboutsummaryrefslogtreecommitdiff
path: root/git-fetch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-01-05 19:42:12 -0800
committerJunio C Hamano <junkio@cox.net>2006-01-05 19:42:12 -0800
commit81214e4ddf2f0114ce7756a014dc533340fcb3f9 (patch)
tree98698aa55c940651245c54945689e19bf364bfa3 /git-fetch.sh
parent353ce81597e831969ac37d6991346f8c39c1488e (diff)
downloadgit-81214e4ddf2f0114ce7756a014dc533340fcb3f9.tar.gz
git-81214e4ddf2f0114ce7756a014dc533340fcb3f9.tar.xz
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>
Diffstat (limited to 'git-fetch.sh')
-rwxr-xr-xgit-fetch.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/git-fetch.sh b/git-fetch.sh
index 125bcea1b..b46b3e558 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -188,11 +188,20 @@ esac
reflist=$(get_remote_refs_for_fetch "$@")
if test "$tags"
then
- taglist=$(git-ls-remote --tags "$remote" |
- sed -e '
- /\^/d
- s/^[^ ]* //
- s/.*/.&:&/')
+ taglist=$(IFS=" " &&
+ git-ls-remote --tags "$remote" |
+ while read sha1 name
+ do
+ 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
then
# remote URL plus explicit refspecs; we need to merge them.