Re: [PATCH 2/2] Unset CURLOPT_FAILONERROR
- Date: Fri, 28 Dec 2018 11:51:12 -0800
- From: Masaya Suzuki <masayasuzuki@xxxxxxxxxx>
- Subject: Re: [PATCH 2/2] Unset CURLOPT_FAILONERROR
On Fri, Dec 28, 2018 at 11:37 AM Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> On Thu, Dec 27, 2018 at 8:47 PM Masaya Suzuki <masayasuzuki@xxxxxxxxxx> wrote:
> > When GIT_CURL_VERBOSE is set, libcurl produces request/response headers
> > to stderr. However, if the response is an error response and
> > CURLOPT_FAILONERROR is set, libcurl stops parsing the response, and it
> > won't ump the headers. Showing HTTP response headers is useful for
> > debugging, especially for non-OK responses.
> > This is substantially same as setting http_options.keep_error to all
> > requests. Hence, removing this option.
> > Signed-off-by: Masaya Suzuki <masayasuzuki@xxxxxxxxxx>
> > ---
> > diff --git a/t/t5581-http-curl-verbose.sh b/t/t5581-http-curl-verbose.sh
> > @@ -0,0 +1,32 @@
> > +test_expect_success 'setup repository' '
> > + ...
> > +'
> > +
> > +test_expect_success 'create http-accessible bare repository' '
> Not a big deal, but this seems like more setup, so it could be folded
> into the "setup" test above it.
> > + mkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
> > + (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
> > + git --bare init
> > + ) &&
> Since this is a new test script, it makes sense to format the subshell
> in the modern style:
> cd ... &&
> git ...
> ) &&
> Alternately, use -C and drop the subshell altogether:
> git -C $BLAH/repo.git --bare init &&
> > + git remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
> > + git push public master:master
> > +'
> > +
> > +test_expect_success 'failure in git-upload-pack is shown' '
> > + (GIT_CURL_VERBOSE=1 git clone --bare "$HTTPD_URL/error_git_upload_pack/smart/repo.git" 2>curl_log ||
> > + true) &&
> Using test_might_fail() would allow you to drop the subshell and the "|| true":
> test_might_fail env GIT_CURL_VERBOSE=1 git clone ... &&
> > + cat curl_log | grep "< HTTP/1.1 500 Intentional Breakage"
> > +'
The test should success. This is a test that a log is produced after a
git command fails. The point of this test is "cat curl_log | grep ..."
part that asserts the log.