summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-07-20 08:51:41 +0200
committerSebastian Thiel <byronimo@gmail.com>2015-07-20 09:20:00 +0200
commit9c272abea2c837e4725c37f5c0467f83f3700cd5 (patch)
tree1f55edfb7cfe0464b22808bf80990e1aea712101 /git/repo/base.py
parentaf44258fa472a14ff25b4715f1ab934d177bf1fa (diff)
downloadgitpython-9c272abea2c837e4725c37f5c0467f83f3700cd5.tar.gz
fix(encoding): in untracked_files() and index
* untracked_files could, if there were spaces in the path returned, re-rencode the previously decoded unicode string thanks to a `decode("string_escape")` call. Now re-encode into utf-8 afterwards - added test to assure this works indeed * IndexFile.add() didn't handle unicode correctly and would write broken index files. The solution was to compute the path length after encoding it into utf-8 bytes, not before ... . Closes #320
Diffstat (limited to 'git/repo/base.py')
-rw-r--r--git/repo/base.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 8b8f8db8..cea88f39 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -625,7 +625,7 @@ class Repo(object):
filename = line[len(prefix):].rstrip('\n')
# Special characters are escaped
if filename[0] == filename[-1] == '"':
- filename = filename[1:-1].decode('string_escape')
+ filename = filename[1:-1].decode('string_escape').decode(defenc)
untracked_files.append(filename)
finalize_process(proc)
return untracked_files