t5801 (remote-helpers): add test to fetch tags
This used to work, but commit e198b3a740 broke it. e198b3a740 (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 <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Jun 3, 2019 at 21:13 UTC
8144f09ccde4df49cdb807a7ce9e6cb14a09bd2e
2 files changed
+22
-5
git-remote-testgit.sh
+12
-5
@@ -12,9 +12,14 @@ url=$2
12
13
dir="$GIT_DIR/testgit/$alias"
14
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/*"
17
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
23
24
GIT_DIR="$url/.git"
25
export GIT_DIR
@@ -37,7 +42,8 @@ do
42
capabilities)
43
echo 'import'
44
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"
47
if test -n "$gitmarks"
48
then
49
echo "*import-marks $gitmarks"
@@ -49,7 +55,7 @@ do
55
echo
56
;;
57
list)
52
- git for-each-ref --format='? %(refname)' 'refs/heads/'
58
+ git for-each-ref --format='? %(refname)' 'refs/heads/' 'refs/tags/'
59
head=$(git symbolic-ref HEAD)
60
echo "@$head HEAD"
61
echo
@@ -78,7 +84,8 @@ do
84
85
echo "feature done"
86
git fast-export \
81
- ${refspec:+"--refspec=$refspec"} \
87
+ ${h_refspec:+"--refspec=$h_refspec"} \
88
+ ${t_refspec:+"--refspec=$t_refspec"} \
89
${testgitmarks:+"--import-marks=$testgitmarks"} \
90
${testgitmarks:+"--export-marks=$testgitmarks"} \
91
$refs
t/t5801-remote-helpers.sh
+10
@@ -301,4 +301,14 @@ test_expect_success 'fetch url' '
301
compare_refs server HEAD local FETCH_HEAD
302
'
303
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
+
314
test_done