Re: [PATCH] fixup! git-remote-testpy: fix path hashing on Python 3
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 28, 2013, 17:53 UTC
- Message-ID
- <7v8v7dxkgl.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20130128112043.GZ7498@serenity.lan>
John Keeping <john@keeping.me.uk> writes:
Show 10 quoted lines
> --- > On Mon, Jan 28, 2013 at 11:44:34AM +0100, Michael Haggerty wrote: >> NAK. It is still not right. If the locale is not utf-8 based, then it >> is incorrect to re-encode the string using utf-8. I think you really >> have to use sys.getfilesystemencoding() as I suggested. > > If you'd asked me what the patch contained I would have said it did use > getfilesystemencoding(), but I can't disbelieve my own eyes :-( > > Junio, please can you squash this in?
Sure. Thanks for double-checking, Michael. I knew there was something missing but I didn't spot the difference myself.
Show 16 quoted lines
> git-remote-testpy.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-remote-testpy.py b/git-remote-testpy.py
> index 6098bdd..ca67899 100644
> --- a/git-remote-testpy.py
> +++ b/git-remote-testpy.py
> @@ -49,7 +49,7 @@ def encode_filepath(path):
> """
> if sys.hexversion < 0x03000000:
> return path
> - return path.encode('utf-8', 'surrogateescape')
> + return path.encode(sys.getfilesystemencoding(), 'surrogateescape')
>
>
> def get_repo(alias, url):