clone_submodule: avoid using `access()` on directories
[git.git] / t / t5561-http-backend.sh
blob9c57d843152dd5861603316650a0f7f440711c52
1 #!/bin/sh
3 test_description='test git-http-backend'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 . ./test-lib.sh
8 . "$TEST_DIRECTORY"/lib-httpd.sh
10 if ! test_have_prereq CURL; then
11 skip_all='skipping raw http-backend tests, curl not available'
12 test_done
15 start_httpd
17 GET() {
18 curl --include "$HTTPD_URL/$SMART/repo.git/$1" >out &&
19 tr '\015' Q <out |
20 sed '
21 s/Q$//
23 ' >act &&
24 echo "HTTP/1.1 $2" >exp &&
25 test_cmp exp act
28 POST() {
29 curl --include --data "$2" \
30 --header "Content-Type: application/x-$1-request" \
31 "$HTTPD_URL/smart/repo.git/$1" >out &&
32 tr '\015' Q <out |
33 sed '
34 s/Q$//
36 ' >act &&
37 echo "HTTP/1.1 $3" >exp &&
38 test_cmp exp act
41 . "$TEST_DIRECTORY"/t556x_common
43 grep '^[^#]' >exp <<EOF
45 ### refs/heads/main
46 ###
47 GET /smart/repo.git/refs/heads/main HTTP/1.1 404 -
49 ### getanyfile default
50 ###
51 GET /smart/repo.git/HEAD HTTP/1.1 200
52 GET /smart/repo.git/info/refs HTTP/1.1 200
53 GET /smart/repo.git/objects/info/packs HTTP/1.1 200
54 GET /smart/repo.git/objects/info/alternates HTTP/1.1 200 -
55 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -
56 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 200
57 GET /smart/repo.git/$PACK_URL HTTP/1.1 200
58 GET /smart/repo.git/$IDX_URL HTTP/1.1 200
60 ### no git-daemon-export-ok
61 ###
62 GET /smart_noexport/repo.git/HEAD HTTP/1.1 404 -
63 GET /smart_noexport/repo.git/info/refs HTTP/1.1 404 -
64 GET /smart_noexport/repo.git/objects/info/packs HTTP/1.1 404 -
65 GET /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 404 -
66 GET /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 404 -
67 GET /smart_noexport/repo.git/$LOOSE_URL HTTP/1.1 404 -
68 GET /smart_noexport/repo.git/$PACK_URL HTTP/1.1 404 -
69 GET /smart_noexport/repo.git/$IDX_URL HTTP/1.1 404 -
71 ### git-daemon-export-ok
72 ###
73 GET /smart_noexport/repo.git/HEAD HTTP/1.1 200
74 GET /smart_noexport/repo.git/info/refs HTTP/1.1 200
75 GET /smart_noexport/repo.git/objects/info/packs HTTP/1.1 200
76 GET /smart_noexport/repo.git/objects/info/alternates HTTP/1.1 200 -
77 GET /smart_noexport/repo.git/objects/info/http-alternates HTTP/1.1 200 -
78 GET /smart_noexport/repo.git/$LOOSE_URL HTTP/1.1 200
79 GET /smart_noexport/repo.git/$PACK_URL HTTP/1.1 200
80 GET /smart_noexport/repo.git/$IDX_URL HTTP/1.1 200
82 ### getanyfile true
83 ###
84 GET /smart/repo.git/HEAD HTTP/1.1 200
85 GET /smart/repo.git/info/refs HTTP/1.1 200
86 GET /smart/repo.git/objects/info/packs HTTP/1.1 200
87 GET /smart/repo.git/objects/info/alternates HTTP/1.1 200 -
88 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 200 -
89 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 200
90 GET /smart/repo.git/$PACK_URL HTTP/1.1 200
91 GET /smart/repo.git/$IDX_URL HTTP/1.1 200
93 ### getanyfile false
94 ###
95 GET /smart/repo.git/HEAD HTTP/1.1 403 -
96 GET /smart/repo.git/info/refs HTTP/1.1 403 -
97 GET /smart/repo.git/objects/info/packs HTTP/1.1 403 -
98 GET /smart/repo.git/objects/info/alternates HTTP/1.1 403 -
99 GET /smart/repo.git/objects/info/http-alternates HTTP/1.1 403 -
100 GET /smart/repo.git/$LOOSE_URL HTTP/1.1 403 -
101 GET /smart/repo.git/$PACK_URL HTTP/1.1 403 -
102 GET /smart/repo.git/$IDX_URL HTTP/1.1 403 -
104 ### uploadpack default
106 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
107 POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -
109 ### uploadpack true
111 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
112 POST /smart/repo.git/git-upload-pack HTTP/1.1 200 -
114 ### uploadpack false
116 GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 403 -
117 POST /smart/repo.git/git-upload-pack HTTP/1.1 403 -
119 ### receivepack default
121 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -
122 POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
124 ### receivepack true
126 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
127 POST /smart/repo.git/git-receive-pack HTTP/1.1 200 -
129 ### receivepack false
131 GET /smart/repo.git/info/refs?service=git-receive-pack HTTP/1.1 403 -
132 POST /smart/repo.git/git-receive-pack HTTP/1.1 403 -
134 test_expect_success 'server request log matches test results' '
135 check_access_log exp
138 test_done