4 cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
10 git
--git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" config
$1 $2
13 test_expect_success
'setup repository' '
18 mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
19 (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
21 : >objects/info/alternates &&
22 : >objects/info/http-alternates
24 git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
25 git push public main:main &&
27 (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
34 git push public main:main &&
36 LOOSE_URL=$(find_file objects/??) &&
37 PACK_URL=$(find_file objects/pack/*.pack) &&
38 IDX_URL=$(find_file objects/pack/*.idx)
44 GET objects
/info
/packs
"$1" &&
45 GET objects
/info
/alternates
"$1" &&
46 GET objects
/info
/http-alternates
"$1" &&
47 GET
$LOOSE_URL "$1" &&
53 GIT_HTTP_EXPORT_ALL
=1 && export GIT_HTTP_EXPORT_ALL
54 test_expect_success
'direct refs/heads/main not found' '
55 GET refs/heads/main "404 Not Found"
57 test_expect_success
'static file is ok' '
58 get_static_files "200 OK"
61 unset GIT_HTTP_EXPORT_ALL
62 test_expect_success
'no export by default' '
63 get_static_files "404 Not Found"
65 test_expect_success
'export if git-daemon-export-ok' '
66 (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
67 touch git-daemon-export-ok
69 get_static_files "200 OK"
72 GIT_HTTP_EXPORT_ALL
=1 && export GIT_HTTP_EXPORT_ALL
73 test_expect_success
'static file if http.getanyfile true is ok' '
74 config http.getanyfile true &&
75 get_static_files "200 OK"
77 test_expect_success
'static file if http.getanyfile false fails' '
78 config http.getanyfile false &&
79 get_static_files "403 Forbidden"
82 test_expect_success
'http.uploadpack default enabled' '
83 GET info/refs?service=git-upload-pack "200 OK" &&
84 POST git-upload-pack 0000 "200 OK"
86 test_expect_success
'http.uploadpack true' '
87 config http.uploadpack true &&
88 GET info/refs?service=git-upload-pack "200 OK" &&
89 POST git-upload-pack 0000 "200 OK"
91 test_expect_success
'http.uploadpack false' '
92 config http.uploadpack false &&
93 GET info/refs?service=git-upload-pack "403 Forbidden" &&
94 POST git-upload-pack 0000 "403 Forbidden"
97 test_expect_success
'http.receivepack default disabled' '
98 GET info/refs?service=git-receive-pack "403 Forbidden" &&
99 POST git-receive-pack 0000 "403 Forbidden"
101 test_expect_success
'http.receivepack true' '
102 config http.receivepack true &&
103 GET info/refs?service=git-receive-pack "200 OK" &&
104 POST git-receive-pack 0000 "200 OK"
106 test_expect_success
'http.receivepack false' '
107 config http.receivepack false &&
108 GET info/refs?service=git-receive-pack "403 Forbidden" &&
109 POST git-receive-pack 0000 "403 Forbidden"