diff options
author | John Keeping <john@keeping.me.uk> | 2013-01-27 14:50:56 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-28 09:55:14 -0800 |
commit | 3ac221a78eba2f447a7990fc5c4709853dc32fee (patch) | |
tree | 459664a579ecdfb4017497d5f54eb63fb0ddaba9 /git_remote_helpers | |
parent | f9640ac26ce0478695487f657718157bb7b4f804 (diff) | |
download | git-3ac221a78eba2f447a7990fc5c4709853dc32fee.tar.gz |
git-remote-testpy: fix path hashing on Python 3
When this change was originally made (0846b0c - git-remote-testpy:
hash bytes explicitly , I didn't realise that the "hex" encoding we
chose is a "bytes to bytes" encoding so it just fails with an error
on Python 3 in the same way as the original code.
It is not possible to provide a single code path that works on
Python 2 and Python 3 since Python 2.x will attempt to decode the
string before encoding it, which fails for strings that are not
valid in the default encoding. Python 3.1 introduced the
"surrogateescape" error handler which handles this correctly and
permits a bytes -> unicode -> bytes round-trip to be lossless. As
the original came from reading the filesystem path, we convert them
back into the original bytes encoded in sys.getfilesystemencoding().
At this point Python 3.0 is unsupported so we don't go out of our
way to try to support it.
Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git_remote_helpers')
0 files changed, 0 insertions, 0 deletions