mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
![SZEDER Gábor](/assets/img/avatar_default.png)
The second 'test_i18ngrep' invocation in the test 'curl redirects
respect whitelist' is missing its filename parameter. This has
remained unnoticed since its introduction in f4113cac0
(http: limit
redirection to protocol-whitelist, 2015-09-22), because it would only
cause the test to fail if Git was built with a sufficiently old
libcurl version. The test's two ||-chained 'test_i18ngrep'
invocations are supposed to check that either one of the two patterns
is present in 'git clone's error message. As it happens, the first
invocation covers the error message from any reasonably up-to-date
libcurl, thus the second invocation, the one without the filename
parameter, isn't executed at all. Apparently no one has run the test
suite's httpd tests with such an old libcurl in the last 2+ years, or
at least they haven't bothered to notify us about the failed test.
Fix this by consolidating the two patterns into a single extended
regexp, eliminating the need for an ||-chained second 'test_i18ngrep'
invocation.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
39 lines
1.1 KiB
Bash
Executable file
39 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='test disabling of git-over-http in clone/fetch'
|
|
. ./test-lib.sh
|
|
. "$TEST_DIRECTORY/lib-proto-disable.sh"
|
|
. "$TEST_DIRECTORY/lib-httpd.sh"
|
|
start_httpd
|
|
|
|
test_expect_success 'create git-accessible repo' '
|
|
bare="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
|
|
test_commit one &&
|
|
git --bare init "$bare" &&
|
|
git push "$bare" HEAD &&
|
|
git -C "$bare" config http.receivepack true
|
|
'
|
|
|
|
test_proto "smart http" http "$HTTPD_URL/smart/repo.git"
|
|
|
|
test_expect_success 'curl redirects respect whitelist' '
|
|
test_must_fail env GIT_ALLOW_PROTOCOL=http:https \
|
|
GIT_SMART_HTTP=0 \
|
|
git clone "$HTTPD_URL/ftp-redir/repo.git" 2>stderr &&
|
|
test_i18ngrep -E "(ftp.*disabled|your curl version is too old)" stderr
|
|
'
|
|
|
|
test_expect_success 'curl limits redirects' '
|
|
test_must_fail git clone "$HTTPD_URL/loop-redir/smart/repo.git"
|
|
'
|
|
|
|
test_expect_success 'http can be limited to from-user' '
|
|
git -c protocol.http.allow=user \
|
|
clone "$HTTPD_URL/smart/repo.git" plain.git &&
|
|
test_must_fail git -c protocol.http.allow=user \
|
|
clone "$HTTPD_URL/smart-redir-perm/repo.git" redir.git
|
|
'
|
|
|
|
stop_httpd
|
|
test_done
|