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

Symlinked paths are excluded from gitignore checks #1773

Merged
merged 1 commit into from Jul 5, 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
10 changes: 9 additions & 1 deletion isort/settings.py
Expand Up @@ -548,7 +548,15 @@ def _check_folder_gitignore(self, folder: str) -> Optional[Path]:

git_folder = Path(topfolder_result.rstrip()).resolve()

files = [str(p) for p in Path(git_folder).rglob("*")]
files: List[str] = []
# don't check symlinks; either part of the repo and would be checked
# twice, or is external to the repo and git won't konw anything about it
for root, _dirs, git_files in os.walk(git_folder, followlinks=False):
for git_file in git_files:
git_path = os.path.join(root, git_file)
# followlinks only disables walking into linked dirs
if not os.path.islink(git_path):
files.append(git_path)
git_options = ["-C", str(git_folder), "-c", "core.quotePath="]
try:
ignored = subprocess.check_output( # nosec # skipcq: PYL-W1510
Expand Down