Skip to content

Commit

Permalink
Use escape_decode to address windows based usage
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley authored Jun 21, 2021
1 parent 761aff4 commit 84664a6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions isort/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Defines how the default settings for isort should be loaded
"""
import codecs
import configparser
import fnmatch
import glob
Expand Down Expand Up @@ -543,12 +544,16 @@ def _check_folder_gitignore(self, folder: str) -> Optional[Path]:
git_folder = Path(topfolder_result.decode("utf-8").split("\n")[0])

files = glob.glob(str(git_folder) + "/**/*", recursive=True)
files_result = subprocess.check_output( # nosec # skipcq: PYL-W1510
["git", "-C", str(git_folder), "check-ignore", "--stdin"],
encoding="utf-8",
env={"LANG": "C.UTF-8"},
input="\n".join(files),
).splitlines()
files_result = (
codecs.escape_decode( # type: ignore
subprocess.check_output( # nosec # skipcq: PYL-W1510
["git", "-C", str(git_folder), "check-ignore", "--stdin"],
input="\n".join(files).encode(),
)
)[0]
.decode("utf-8")
.splitlines()
)

self.git_ignore[git_folder] = {Path(f.strip('"')) for f in files_result}

Expand Down

0 comments on commit 84664a6

Please sign in to comment.