Skip to content

Commit 6c96c0f

Browse files
author
Junio C Hamano
committed
git-fetch: follow lightweit tags as well.
This side-ports commit fd19f620 from Cogito, in which I fixed exactly the same bug. Somehow nobody noticed this for a long time in git. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 198a4f4 commit 6c96c0f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

git-fetch.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,11 @@ case "$no_tags$tags" in
432432
# using local tracking branch.
433433
taglist=$(IFS=" " &&
434434
git-ls-remote $upload_pack --tags "$remote" |
435-
sed -ne 's|^\([0-9a-f]*\)[ ]\(refs/tags/.*\)^{}$|\1 \2|p' |
435+
sed -n -e 's|^\('"$_x40"'\) \(refs/tags/.*\)^{}$|\1 \2|p' \
436+
-e 's|^\('"$_x40"'\) \(refs/tags/.*\)$|\1 \2|p' |
436437
while read sha1 name
437438
do
438-
git-show-ref --verify --quiet -- $name && continue
439+
git-show-ref --verify --quiet -- "$name" && continue
439440
git-check-ref-format "$name" || {
440441
echo >&2 "warning: tag ${name} ignored"
441442
continue

t/t5510-fetch.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,20 @@ test_expect_success "fetch test for-merge" '
6666
cut -f -2 .git/FETCH_HEAD >actual &&
6767
diff expected actual'
6868

69+
test_expect_success 'fetch following tags' '
70+
71+
cd "$D" &&
72+
git tag -a -m 'annotated' anno HEAD &&
73+
git tag light HEAD &&
74+
75+
mkdir four &&
76+
cd four &&
77+
git init-db &&
78+
79+
git fetch .. :track &&
80+
git show-ref --verify refs/tags/anno &&
81+
git show-ref --verify refs/tags/light
82+
83+
'
84+
6985
test_done

0 commit comments

Comments
 (0)