git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] fixup! git-remote-testpy: fix path hashing on Python 3

From
John Keeping <john@keeping.me.uk>
Date
Jan 28, 2013, 11:20 UTC
Message-ID
<20130128112043.GZ7498@serenity.lan>
In-Reply-To
<51065692.9000708@alum.mit.edu>

--- 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?
 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):
-- 
1.8.1.1
Previous: Michael HaggertyNext: Junio C Hamano
Message 35 of 38 in “Python 3 support for git_remote_helpers”
  1. 0/8 Python 3 support for git_remote_helpersJohn Keeping, Jan 20, 2013
  2. 1/8 git_remote_helpers: Allow building with Python 3John Keeping, Jan 20, 2013
  3. Sverre RabbelierJan 23, 2013
  4. 2/8 git_remote_helpers: fix input when running under Python 3John Keeping, Jan 20, 2013
  5. Sverre RabbelierJan 23, 2013
  6. John KeepingJan 23, 2013
  7. Sverre RabbelierJan 23, 2013
  8. Junio C HamanoJan 23, 2013
  9. Brandon CaseyJan 25, 2013
  10. Erik Faye-LundFeb 5, 2013
  11. 3/8 git_remote_helpers: Force rebuild if python version changesJohn Keeping, Jan 20, 2013
  12. Sverre RabbelierJan 23, 2013
  13. 4/8 git_remote_helpers: Use 2to3 if building with Python 3John Keeping, Jan 20, 2013
  14. 5/8 svn-fe: allow svnrdump_sim.py to run with Python 3John Keeping, Jan 20, 2013
  15. 6/8 git-remote-testpy: hash bytes explicitlyJohn Keeping, Jan 20, 2013
  16. John KeepingJan 26, 2013
  17. Junio C HamanoJan 26, 2013
  18. git-remote-testpy: fix patch hashing on Python 3John Keeping, Jan 26, 2013
  19. Michael HaggertyJan 27, 2013
  20. Junio C HamanoJan 27, 2013
  21. John KeepingJan 27, 2013
  22. Sverre RabbelierJan 27, 2013
  23. Michael HaggertyJan 27, 2013
  24. John KeepingJan 27, 2013
  25. git-remote-testpy: fix patch hashing on Python 3John Keeping, Jan 27, 2013
  26. Junio C HamanoJan 27, 2013
  27. John KeepingJan 27, 2013
  28. Junio C HamanoJan 27, 2013
  29. John KeepingJan 27, 2013
  30. Junio C HamanoJan 27, 2013
  31. Junio C HamanoJan 27, 2013
  32. John KeepingJan 27, 2013
  33. Junio C HamanoJan 27, 2013
  34. Michael HaggertyJan 28, 2013
  35. fixup! git-remote-testpy: fix path hashing on Python 3John Keeping, Jan 28, 2013
  36. Junio C HamanoJan 28, 2013
  37. 7/8 git-remote-testpy: don't do unbuffered text I/OJohn Keeping, Jan 20, 2013
  38. 8/8 git-remote-testpy: call print as a functionJohn Keeping, Jan 20, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.