aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-fetch.sh5
-rwxr-xr-xt/t5510-fetch.sh16
2 files changed, 19 insertions, 2 deletions
diff --git a/git-fetch.sh b/git-fetch.sh
index 7442dd2ca..eb32476bb 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -432,10 +432,11 @@ case "$no_tags$tags" in
# using local tracking branch.
taglist=$(IFS=" " &&
git-ls-remote $upload_pack --tags "$remote" |
- sed -ne 's|^\([0-9a-f]*\)[ ]\(refs/tags/.*\)^{}$|\1 \2|p' |
+ sed -n -e 's|^\('"$_x40"'\) \(refs/tags/.*\)^{}$|\1 \2|p' \
+ -e 's|^\('"$_x40"'\) \(refs/tags/.*\)$|\1 \2|p' |
while read sha1 name
do
- git-show-ref --verify --quiet -- $name && continue
+ git-show-ref --verify --quiet -- "$name" && continue
git-check-ref-format "$name" || {
echo >&2 "warning: tag ${name} ignored"
continue
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index df0ae4811..a11ab0ad4 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -66,4 +66,20 @@ test_expect_success "fetch test for-merge" '
cut -f -2 .git/FETCH_HEAD >actual &&
diff expected actual'
+test_expect_success 'fetch following tags' '
+
+ cd "$D" &&
+ git tag -a -m 'annotated' anno HEAD &&
+ git tag light HEAD &&
+
+ mkdir four &&
+ cd four &&
+ git init-db &&
+
+ git fetch .. :track &&
+ git show-ref --verify refs/tags/anno &&
+ git show-ref --verify refs/tags/light
+
+'
+
test_done