3 test_description='ext::cmd remote "connect" helper'
6 test_expect_success setup '
7 git config --global protocol.ext.allow user &&
9 git commit --allow-empty -m initial &&
11 git commit --allow-empty -m second &&
13 git commit --allow-empty -m third &&
15 git tag -a -m "tip three" three &&
18 git commit --allow-empty -m fourth
21 test_expect_success clone '
22 cmd=$(echo "echo >&2 ext::sh invoked && %S .." | sed -e "s/ /% /g") &&
23 git clone "ext::sh -c %S% ." dst &&
24 git for-each-ref refs/heads/ refs/tags/ >expect &&
27 git config remote.origin.url "ext::sh -c $cmd" &&
28 git for-each-ref refs/heads/ refs/tags/
30 test_cmp expect actual
33 test_expect_success 'update following tag' '
35 git commit --allow-empty -m fifth &&
37 git tag -a -m "tip five" five &&
38 git for-each-ref refs/heads/ refs/tags/ >expect &&
42 git for-each-ref refs/heads/ refs/tags/ >../actual
44 test_cmp expect actual
47 test_expect_success 'update backfilled tag' '
49 git commit --allow-empty -m sixth &&
51 git tag -a -m "tip two" two three^1 &&
52 git for-each-ref refs/heads/ refs/tags/ >expect &&
56 git for-each-ref refs/heads/ refs/tags/ >../actual
58 test_cmp expect actual
61 test_expect_success 'update backfilled tag without primary transfer' '
63 git tag -a -m "tip one " one two^1 &&
64 git for-each-ref refs/heads/ refs/tags/ >expect &&
68 git for-each-ref refs/heads/ refs/tags/ >../actual
70 test_cmp expect actual
74 test_expect_success 'set up fake git-daemon' '
76 git init --bare remote/one.git &&
78 git init --bare remote/host/two.git &&
79 write_script fake-daemon <<-\EOF &&
81 --informative-errors \
83 --base-path="$TRASH_DIRECTORY/remote" \
84 --interpolated-path="$TRASH_DIRECTORY/remote/%H%D" \
85 "$TRASH_DIRECTORY/remote"
87 export TRASH_DIRECTORY &&
88 PATH=$TRASH_DIRECTORY:$PATH
91 test_expect_success 'ext command can connect to git daemon (no vhost)' '
93 git clone "ext::fake-daemon %G/one.git" dst
96 test_expect_success 'ext command can connect to git daemon (vhost)' '
98 git clone "ext::fake-daemon %G/two.git %Vhost" dst