summaryrefslogtreecommitdiff
path: root/t/t5541-http-push-smart.sh
diff options
context:
space:
mode:
authorLi Linchao <lilinchao@oschina.cn>2022-07-11 05:58:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-07-11 19:24:28 (GMT)
commitb0c4adcdd7e339110bea8da94d7880d413e49330 (patch)
tree3554a2e0abcefedb309d3d0a2ade3a898c704001 /t/t5541-http-push-smart.sh
parent1e59178e3f65880188caedb965e70db5ceeb2d64 (diff)
downloadgit-b0c4adcdd7e339110bea8da94d7880d413e49330.zip
git-b0c4adcdd7e339110bea8da94d7880d413e49330.tar.gz
git-b0c4adcdd7e339110bea8da94d7880d413e49330.tar.bz2
remote-curl: send Accept-Language header to server
Git server end's ability to accept Accept-Language header was introduced in f18604bbf2 (http: add Accept-Language header if possible, 2015-01-28), but this is only used by very early phase of the transfer, which is HTTP GET request to discover references. For other phases, like POST request in the smart HTTP, the server does not know what language the client speaks. Teach git client to learn end-user's preferred language and throw accept-language header to the server side. Once the server gets this header, it has the ability to talk to end-user with language they understand. This would be very helpful for many non-English speakers. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Li Linchao <lilinchao@oschina.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5541-http-push-smart.sh')
-rwxr-xr-xt/t5541-http-push-smart.sh19
1 files changed, 19 insertions, 0 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
'