setup_bare_git_dir(): help static analysis
[git/debian.git] / t / t5802-connect-helper.sh
blobc6c2661878c0ca8a22ad11e1229a664f3d009fee
1 #!/bin/sh
3 test_description='ext::cmd remote "connect" helper'
4 . ./test-lib.sh
6 test_expect_success setup '
7 git config --global protocol.ext.allow user &&
8 test_tick &&
9 git commit --allow-empty -m initial &&
10 test_tick &&
11 git commit --allow-empty -m second &&
12 test_tick &&
13 git commit --allow-empty -m third &&
14 test_tick &&
15 git tag -a -m "tip three" three &&
17 test_tick &&
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 &&
26 cd dst &&
27 git config remote.origin.url "ext::sh -c $cmd" &&
28 git for-each-ref refs/heads/ refs/tags/
29 ) >actual &&
30 test_cmp expect actual
33 test_expect_success 'update following tag' '
34 test_tick &&
35 git commit --allow-empty -m fifth &&
36 test_tick &&
37 git tag -a -m "tip five" five &&
38 git for-each-ref refs/heads/ refs/tags/ >expect &&
40 cd dst &&
41 git pull &&
42 git for-each-ref refs/heads/ refs/tags/ >../actual
43 ) &&
44 test_cmp expect actual
47 test_expect_success 'update backfilled tag' '
48 test_tick &&
49 git commit --allow-empty -m sixth &&
50 test_tick &&
51 git tag -a -m "tip two" two three^1 &&
52 git for-each-ref refs/heads/ refs/tags/ >expect &&
54 cd dst &&
55 git pull &&
56 git for-each-ref refs/heads/ refs/tags/ >../actual
57 ) &&
58 test_cmp expect actual
61 test_expect_success 'update backfilled tag without primary transfer' '
62 test_tick &&
63 git tag -a -m "tip one " one two^1 &&
64 git for-each-ref refs/heads/ refs/tags/ >expect &&
66 cd dst &&
67 git pull &&
68 git for-each-ref refs/heads/ refs/tags/ >../actual
69 ) &&
70 test_cmp expect actual
74 test_expect_success 'set up fake git-daemon' '
75 mkdir remote &&
76 git init --bare remote/one.git &&
77 mkdir remote/host &&
78 git init --bare remote/host/two.git &&
79 write_script fake-daemon <<-\EOF &&
80 git daemon --inetd \
81 --informative-errors \
82 --export-all \
83 --base-path="$TRASH_DIRECTORY/remote" \
84 --interpolated-path="$TRASH_DIRECTORY/remote/%H%D" \
85 "$TRASH_DIRECTORY/remote"
86 EOF
87 export TRASH_DIRECTORY &&
88 PATH=$TRASH_DIRECTORY:$PATH
91 test_expect_success 'ext command can connect to git daemon (no vhost)' '
92 rm -rf dst &&
93 git clone "ext::fake-daemon %G/one.git" dst
96 test_expect_success 'ext command can connect to git daemon (vhost)' '
97 rm -rf dst &&
98 git clone "ext::fake-daemon %G/two.git %Vhost" dst
101 test_done