debian: Replace asciidoc footer patch with one that’s more upstreamable
[git/debian.git] / t / t5802-connect-helper.sh
blobb7a7f9d5886f1e2f3fc2d65bfcf1785b890638ac
1 #!/bin/sh
3 test_description='ext::cmd remote "connect" helper'
4 . ./test-lib.sh
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 &&
16 test_tick &&
17 git commit --allow-empty -m fourth
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 &&
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
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 &&
39 cd dst &&
40 git pull &&
41 git for-each-ref refs/heads/ refs/tags/ >../actual
42 ) &&
43 test_cmp expect actual
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 &&
53 cd dst &&
54 git pull &&
55 git for-each-ref refs/heads/ refs/tags/ >../actual
56 ) &&
57 test_cmp expect actual
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 &&
65 cd dst &&
66 git pull &&
67 git for-each-ref refs/heads/ refs/tags/ >../actual
68 ) &&
69 test_cmp expect actual
73 test_expect_success 'set up fake git-daemon' '
74 mkdir remote &&
75 git init --bare remote/one.git &&
76 mkdir remote/host &&
77 git init --bare remote/host/two.git &&
78 write_script fake-daemon <<-\EOF &&
79 git daemon --inetd \
80 --informative-errors \
81 --export-all \
82 --base-path="$TRASH_DIRECTORY/remote" \
83 --interpolated-path="$TRASH_DIRECTORY/remote/%H%D" \
84 "$TRASH_DIRECTORY/remote"
85 EOF
86 export TRASH_DIRECTORY &&
87 PATH=$TRASH_DIRECTORY:$PATH
90 test_expect_success 'ext command can connect to git daemon (no vhost)' '
91 rm -rf dst &&
92 git clone "ext::fake-daemon %G/one.git" dst
95 test_expect_success 'ext command can connect to git daemon (vhost)' '
96 rm -rf dst &&
97 git clone "ext::fake-daemon %G/two.git %Vhost" dst
100 test_done