Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a pipe to pass filenames to git check-ignore #1759

Merged
merged 2 commits into from Jun 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions isort/settings.py
Expand Up @@ -547,13 +547,13 @@ def _check_folder_gitignore(self, folder: str) -> Optional[Path]:
files_result = (
codecs.escape_decode( # type: ignore
subprocess.check_output( # nosec # skipcq: PYL-W1510
["git", "-C", str(git_folder), "check-ignore", *files]
["git", "-C", str(git_folder), "check-ignore", "--stdin"],
input="\n".join(files).encode(),
)
)[0]
.decode("utf-8")
.split("\n")
.splitlines()
)
files_result = files_result[:-1] if files_result else files_result

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

Expand Down