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