summaryrefslogtreecommitdiff
path: root/git-gui--askpass
diff options
context:
space:
mode:
authorLibravatar Luke Bonanomi <lbonanomi@gmail.com>2020-03-12 21:31:50 +0000
committerLibravatar Pratyush Yadav <me@yadavpratyush.com>2020-03-14 22:46:40 +0530
commit850cf9ae961ce59c980b0c59abd3dd676fb7b7ec (patch)
treed272db6a57243cb809379028c3829c1abd743eb3 /git-gui--askpass
parentMerge branch 'py/blame-status-error' (diff)
downloadtgif-850cf9ae961ce59c980b0c59abd3dd676fb7b7ec.tar.xz
git-gui--askpass: coerce answers to UTF-8 on Windows
This addresses the issue where Git for Windows asks the user for a password, no credential helper is available, and then Git fails to pick up non-ASCII characters from the Git GUI helper. This can be verified e.g. via echo host=http://abc.com | git -c credential.helper= credential fill and then pasting some umlauts. The underlying reason is that Git for Windows tries to communicate using the UTF-8 encoding no matter what the actual current code page is. So let's indulge Git for Windows and do use that encoding. This fixes https://github.com/git-for-windows/git/issues/2215 Signed-off-by: Luke Bonanomi <lbonanomi@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
Diffstat (limited to 'git-gui--askpass')
-rwxr-xr-xgit-gui--askpass5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-gui--askpass b/git-gui--askpass
index 4277f30c41..1c99ee8ca2 100755
--- a/git-gui--askpass
+++ b/git-gui--askpass
@@ -56,6 +56,11 @@ proc finish {} {
}
}
+ # On Windows, force the encoding to UTF-8: it is what `git.exe` expects
+ if {$::tcl_platform(platform) eq {windows}} {
+ set ::answer [encoding convertto utf-8 $::answer]
+ }
+
puts $::answer
set ::rc 0
}