Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3c8a33e

Browse files
committed
fix(encoding): inuntracked_files()
I have no idea why PY3 requires such a mess of encoding/decodingstatements, but let's just be happy it works.Also let's be sure I never ever write python code again ... EVER.
1 parent9c272ab commit3c8a33e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎git/repo/base.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
)
5555
fromgit.compatimport (
5656
text_type,
57-
defenc
57+
force_text,
58+
defenc,
59+
PY3
5860
)
5961

6062
importos
@@ -625,7 +627,12 @@ def _get_untracked_files(self, **kwargs):
625627
filename=line[len(prefix):].rstrip('\n')
626628
# Special characters are escaped
627629
iffilename[0]==filename[-1]=='"':
628-
filename=filename[1:-1].decode('string_escape').decode(defenc)
630+
filename=filename[1:-1]
631+
ifPY3:
632+
# WHATEVER ... it's a mess, but works for me
633+
filename=filename.encode('ascii').decode('unicode_escape').encode('latin1').decode(defenc)
634+
else:
635+
filename=filename.decode('string_escape').decode(defenc)
629636
untracked_files.append(filename)
630637
finalize_process(proc)
631638
returnuntracked_files

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp