summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-07-19 23:40:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-19 23:40:19 (GMT)
commit4b8cdff8baa44c97a784d5b4b6c5a9df37de41ff (patch)
tree5df6944aaee80778b5445c3fad9a01385692cb98 /t
parent7c683389d689c85e66d9c2ce1fba198da4325e3a (diff)
parentb0c4adcdd7e339110bea8da94d7880d413e49330 (diff)
downloadgit-4b8cdff8baa44c97a784d5b4b6c5a9df37de41ff.zip
git-4b8cdff8baa44c97a784d5b4b6c5a9df37de41ff.tar.gz
git-4b8cdff8baa44c97a784d5b4b6c5a9df37de41ff.tar.bz2
Merge branch 'll/curl-accept-language'
Earlier, HTTP transport clients learned to tell the server side what locale they are in by sending Accept-Language HTTP header, but this was done only for some requests but not others. * ll/curl-accept-language: remote-curl: send Accept-Language header to server
Diffstat (limited to 't')
-rwxr-xr-xt/t5541-http-push-smart.sh19
-rwxr-xr-xt/t5550-http-fetch-dumb.sh2
-rwxr-xr-xt/t5551-http-fetch-smart.sh10
3 files changed, 28 insertions, 3 deletions
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index 2f09ff4..fbad2d5 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -80,6 +80,25 @@ test_expect_success 'push to remote repository (standard)' '
test $HEAD = $(git rev-parse --verify HEAD))
'
+test_expect_success 'push to remote repository (standard) with sending Accept-Language' '
+ cat >exp <<-\EOF &&
+ => Send header: Accept-Language: ko-KR, *;q=0.9
+ => Send header: Accept-Language: ko-KR, *;q=0.9
+ EOF
+
+ cd "$ROOT_PATH"/test_repo_clone &&
+ : >path_lang &&
+ git add path_lang &&
+ test_tick &&
+ git commit -m path_lang &&
+ HEAD=$(git rev-parse --verify HEAD) &&
+ GIT_TRACE_CURL=true LANGUAGE="ko_KR.UTF-8" git push -v -v 2>err &&
+ ! grep "Expect: 100-continue" err &&
+
+ grep "=> Send header: Accept-Language:" err >err.language &&
+ test_cmp exp err.language
+'
+
test_expect_success 'push already up-to-date' '
git push
'
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index 3ca621f..d7cf85f 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -369,7 +369,7 @@ ja;q=0.95, zh;q=0.94, sv;q=0.93, pt;q=0.92, nb;q=0.91, *;q=0.90" \
ko_KR.EUC-KR:en_US.UTF-8:fr_CA:de.UTF-8@euro:sr@latin:ja:zh:sv:pt:nb
'
-test_expect_success 'git client does not send an empty Accept-Language' '
+test_expect_success 'git client send an empty Accept-Language' '
GIT_TRACE_CURL=true LANGUAGE= git ls-remote "$HTTPD_URL/dumb/repo.git" 2>stderr &&
! grep "^=> Send header: Accept-Language:" stderr
'
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index b9351a7..245532d 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -31,6 +31,7 @@ test_expect_success 'clone http repository' '
> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
> Accept: */*
> Accept-Encoding: ENCODINGS
+ > Accept-Language: ko-KR, *;q=0.9
> Pragma: no-cache
< HTTP/1.1 200 OK
< Pragma: no-cache
@@ -40,13 +41,15 @@ test_expect_success 'clone http repository' '
> Accept-Encoding: ENCODINGS
> Content-Type: application/x-git-upload-pack-request
> Accept: application/x-git-upload-pack-result
+ > Accept-Language: ko-KR, *;q=0.9
> Content-Length: xxx
< HTTP/1.1 200 OK
< Pragma: no-cache
< Cache-Control: no-cache, max-age=0, must-revalidate
< Content-Type: application/x-git-upload-pack-result
EOF
- GIT_TRACE_CURL=true GIT_TEST_PROTOCOL_VERSION=0 \
+
+ GIT_TRACE_CURL=true GIT_TEST_PROTOCOL_VERSION=0 LANGUAGE="ko_KR.UTF-8" \
git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
test_cmp file clone/file &&
tr '\''\015'\'' Q <err |
@@ -94,7 +97,10 @@ test_expect_success 'clone http repository' '
test_cmp exp actual.smudged &&
grep "Accept-Encoding:.*gzip" actual >actual.gzip &&
- test_line_count = 2 actual.gzip
+ test_line_count = 2 actual.gzip &&
+
+ grep "Accept-Language: ko-KR, *" actual >actual.language &&
+ test_line_count = 2 actual.language
fi
'