Skip to content

Commit 8144f09

Browse files
felipecgitster
authored andcommitted
t5801 (remote-helpers): add test to fetch tags
This used to work, but commit e198b3a broke it. e198b3a (fetch: replace string-list used as a look-up table with a hashmap) Probably all remote helpers that use the import method are affected, but we didn't catch the issue. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6e17fb3 commit 8144f09

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

git-remote-testgit.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ url=$2
1212

1313
dir="$GIT_DIR/testgit/$alias"
1414

15-
refspec="refs/heads/*:refs/testgit/$alias/heads/*"
15+
h_refspec="refs/heads/*:refs/testgit/$alias/heads/*"
16+
t_refspec="refs/tags/*:refs/testgit/$alias/tags/*"
1617

17-
test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC" && refspec=""
18+
if test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC"
19+
then
20+
h_refspec=""
21+
t_refspec=""
22+
fi
1823

1924
GIT_DIR="$url/.git"
2025
export GIT_DIR
@@ -37,7 +42,8 @@ do
3742
capabilities)
3843
echo 'import'
3944
echo 'export'
40-
test -n "$refspec" && echo "refspec $refspec"
45+
test -n "$h_refspec" && echo "refspec $h_refspec"
46+
test -n "$t_refspec" && echo "refspec $t_refspec"
4147
if test -n "$gitmarks"
4248
then
4349
echo "*import-marks $gitmarks"
@@ -49,7 +55,7 @@ do
4955
echo
5056
;;
5157
list)
52-
git for-each-ref --format='? %(refname)' 'refs/heads/'
58+
git for-each-ref --format='? %(refname)' 'refs/heads/' 'refs/tags/'
5359
head=$(git symbolic-ref HEAD)
5460
echo "@$head HEAD"
5561
echo
@@ -78,7 +84,8 @@ do
7884

7985
echo "feature done"
8086
git fast-export \
81-
${refspec:+"--refspec=$refspec"} \
87+
${h_refspec:+"--refspec=$h_refspec"} \
88+
${t_refspec:+"--refspec=$t_refspec"} \
8289
${testgitmarks:+"--import-marks=$testgitmarks"} \
8390
${testgitmarks:+"--export-marks=$testgitmarks"} \
8491
$refs

t/t5801-remote-helpers.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,14 @@ test_expect_success 'fetch url' '
301301
compare_refs server HEAD local FETCH_HEAD
302302
'
303303

304+
test_expect_failure 'fetch tag' '
305+
(cd server &&
306+
git tag v1.0
307+
) &&
308+
(cd local &&
309+
git fetch
310+
) &&
311+
compare_refs local v1.0 server v1.0
312+
'
313+
304314
test_done

0 commit comments

Comments
 (0)