| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='test disabling of git-over-http in clone/fetch' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | . "$TEST_DIRECTORY/lib-proto-disable.sh" |
| 7 | . "$TEST_DIRECTORY/lib-httpd.sh" |
| 8 | start_httpd |
| 9 | |
| 10 | test_expect_success 'create git-accessible repo' ' |
| 11 | bare="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && |
| 12 | test_commit one && |
| 13 | git --bare init "$bare" && |
| 14 | git push "$bare" HEAD && |
| 15 | git -C "$bare" config http.receivepack true |
| 16 | ' |
| 17 | |
| 18 | test_proto "smart http" http "$HTTPD_URL/smart/repo.git" |
| 19 | |
| 20 | test_expect_success 'http(s) transport respects GIT_ALLOW_PROTOCOL' ' |
| 21 | test_must_fail env GIT_ALLOW_PROTOCOL=http:https \ |
| 22 | GIT_SMART_HTTP=0 \ |
| 23 | git clone "$HTTPD_URL/ftp-redir/repo.git" 2>stderr && |
| 24 | test_grep -E "(ftp.*disabled|your curl version is too old)" stderr |
| 25 | ' |
| 26 | |
| 27 | test_expect_success 'curl limits redirects' ' |
| 28 | test_must_fail git clone "$HTTPD_URL/loop-redir/smart/repo.git" |
| 29 | ' |
| 30 | |
| 31 | test_expect_success 'http can be limited to from-user' ' |
| 32 | git -c protocol.http.allow=user \ |
| 33 | clone "$HTTPD_URL/smart/repo.git" plain.git && |
| 34 | test_must_fail git -c protocol.http.allow=user \ |
| 35 | clone "$HTTPD_URL/smart-redir-perm/repo.git" redir.git |
| 36 | ' |
| 37 | |
| 38 | test_done |