Skip to content

Commit e4871cd

Browse files
draftcodegitster
authored andcommitted
test: test GIT_CURL_VERBOSE=1 shows an error
This tests GIT_CURL_VERBOSE shows an error when an URL returns 500. This exercises the code in remote_curl. Signed-off-by: Masaya Suzuki <masayasuzuki@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b79bdd8 commit e4871cd

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

t/lib-httpd/apache.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Alias /auth/dumb/ www/auth/dumb/
115115
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
116116
SetEnv GIT_HTTP_EXPORT_ALL
117117
</LocationMatch>
118+
ScriptAliasMatch /error_git_upload_pack/(.*)/git-upload-pack error.sh/
118119
ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
119120
ScriptAlias /broken_smart/ broken-smart-http.sh/
120121
ScriptAlias /error/ error.sh/

t/t5581-http-curl-verbose.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
test_description='test GIT_CURL_VERBOSE'
4+
. ./test-lib.sh
5+
. "$TEST_DIRECTORY"/lib-httpd.sh
6+
start_httpd
7+
8+
test_expect_success 'setup repository' '
9+
mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
10+
git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" --bare init &&
11+
git config push.default matching &&
12+
echo content >file &&
13+
git add file &&
14+
git commit -m one &&
15+
git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
16+
git push public master:master
17+
'
18+
19+
test_expect_success 'failure in git-upload-pack is shown' '
20+
test_might_fail env GIT_CURL_VERBOSE=1 \
21+
git clone "$HTTPD_URL/error_git_upload_pack/smart/repo.git" \
22+
2>curl_log &&
23+
grep "< HTTP/1.1 500 Intentional Breakage" curl_log
24+
'
25+
26+
stop_httpd
27+
28+
test_done

0 commit comments

Comments
 (0)