Skip to content

Commit b9ccf55

Browse files
committed
t5802: add test for connect helper
This is an attempt to reproduce a problem reported for a third-party custom "connect" remote helper. The conjecture is that sometimes "git fetch" wants to make two connections (one for the primary transfer with 'follow-tags' option set, and then after noticing that some tags are not packed because the primary transfer did not have to send any commit that is pointed by them, another to explicitly ask for the missing tags), and their "connect" helper is not called in the second request, breaking the "fetch" as a whole. Unfortunately this test script does not trigger the alleged failure and happily passes when talking to upload-pack from git-core (see patch 5/5 for details). Signed-off-by: Junio C Hamano <[email protected]>
1 parent fb56570 commit b9ccf55

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

t/t5802-connect-helper.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/sh
2+
3+
test_description='ext::cmd remote "connect" helper'
4+
. ./test-lib.sh
5+
6+
test_expect_success setup '
7+
test_tick &&
8+
git commit --allow-empty -m initial &&
9+
test_tick &&
10+
git commit --allow-empty -m second &&
11+
test_tick &&
12+
git commit --allow-empty -m third &&
13+
test_tick &&
14+
git tag -a -m "tip three" three &&
15+
16+
test_tick &&
17+
git commit --allow-empty -m fourth
18+
'
19+
20+
test_expect_success clone '
21+
cmd=$(echo "echo >&2 ext::sh invoked && %S .." | sed -e "s/ /% /g") &&
22+
git clone "ext::sh -c %S% ." dst &&
23+
git for-each-ref refs/heads/ refs/tags/ >expect &&
24+
(
25+
cd dst &&
26+
git config remote.origin.url "ext::sh -c $cmd" &&
27+
git for-each-ref refs/heads/ refs/tags/
28+
) >actual &&
29+
test_cmp expect actual
30+
'
31+
32+
test_expect_success 'update following tag' '
33+
test_tick &&
34+
git commit --allow-empty -m fifth &&
35+
test_tick &&
36+
git tag -a -m "tip five" five &&
37+
git for-each-ref refs/heads/ refs/tags/ >expect &&
38+
(
39+
cd dst &&
40+
git pull &&
41+
git for-each-ref refs/heads/ refs/tags/ >../actual
42+
) &&
43+
test_cmp expect actual
44+
'
45+
46+
test_expect_success 'update backfilled tag' '
47+
test_tick &&
48+
git commit --allow-empty -m sixth &&
49+
test_tick &&
50+
git tag -a -m "tip two" two three^1 &&
51+
git for-each-ref refs/heads/ refs/tags/ >expect &&
52+
(
53+
cd dst &&
54+
git pull &&
55+
git for-each-ref refs/heads/ refs/tags/ >../actual
56+
) &&
57+
test_cmp expect actual
58+
'
59+
60+
test_expect_success 'update backfilled tag without primary transfer' '
61+
test_tick &&
62+
git tag -a -m "tip one " one two^1 &&
63+
git for-each-ref refs/heads/ refs/tags/ >expect &&
64+
(
65+
cd dst &&
66+
git pull &&
67+
git for-each-ref refs/heads/ refs/tags/ >../actual
68+
) &&
69+
test_cmp expect actual
70+
'
71+
72+
test_done

0 commit comments

Comments
 (0)