summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-07-20 09:19:38 +0200
committerSebastian Thiel <byronimo@gmail.com>2015-07-20 09:20:00 +0200
commit3c8a33e2c9cae8deef1770a5fce85acb2e85b5c6 (patch)
tree15ba6c3a06898459c75dc6e5e39c3f86aa1f5cb9
parent9c272abea2c837e4725c37f5c0467f83f3700cd5 (diff)
downloadgitpython-3c8a33e2c9cae8deef1770a5fce85acb2e85b5c6.tar.gz
fix(encoding): in `untracked_files()`
I have no idea why PY3 requires such a mess of encoding/decoding statements, but let's just be happy it works. Also let's be sure I never ever write python code again ... EVER.
-rw-r--r--git/repo/base.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index cea88f39..5be63d86 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -54,7 +54,9 @@ from .fun import (
)
from git.compat import (
text_type,
- defenc
+ force_text,
+ defenc,
+ PY3
)
import os
@@ -625,7 +627,12 @@ 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').decode(defenc)
+ filename = filename[1:-1]
+ if PY3:
+ # WHATEVER ... it's a mess, but works for me
+ filename = filename.encode('ascii').decode('unicode_escape').encode('latin1').decode(defenc)
+ else:
+ filename = filename.decode('string_escape').decode(defenc)
untracked_files.append(filename)
finalize_process(proc)
return untracked_files