diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-07-15 11:45:16 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-07-15 11:47:14 +0200 |
commit | cbb58869063fe803d232f099888fe9c23510de7b (patch) | |
tree | 60c943b60c2bd1dec56cdf9596ba89b24c116953 /lib/git/objects/fun.py | |
parent | 33819a21f419453bc2b4ca45b640b9a59361ed2b (diff) | |
download | gitpython-cbb58869063fe803d232f099888fe9c23510de7b.tar.gz |
Unicode: tree_to_stream can now handle unicode names the way git would do it. Its can be assumed though that there are more bugs related to unicode hanging around in the system
Diffstat (limited to 'lib/git/objects/fun.py')
-rw-r--r-- | lib/git/objects/fun.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/git/objects/fun.py b/lib/git/objects/fun.py index e56ef8fe..e73e93b0 100644 --- a/lib/git/objects/fun.py +++ b/lib/git/objects/fun.py @@ -25,6 +25,13 @@ def tree_to_stream(entries, write): mode_str = mode_str[1:] # END save a byte + # here it comes: if the name is actually unicode, the replacement below + # will not work as the binsha is not part of the ascii unicode encoding - + # hence we must convert to an utf8 string for it to work properly. + # According to my tests, this is exactly what git does, that is it just + # takes the input literally, which appears to be utf8 on linux. + if isinstance(name, unicode): + name = name.encode("utf8") write("%s %s\0%s" % (mode_str, name, binsha)) # END for each item |