Visitar URL original
Stop configuration discovery at Git worktree boundaries by vzer200 · Pull Request #2654 · PyCQA/isort · GitHub
Skip to content

Stop configuration discovery at Git worktree boundaries - #2654

Merged
DanielNoord merged 1 commit into
PyCQA:mainfrom
vzer200:issue/2068
Sep 21, 2026
Merged

DanielNoord merged 1 commit into
PyCQA:mainfrom
vzer200:issue/2068

Conversation

@vzer200

@vzer200 vzer200 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

When a Git worktree has no local isort configuration, its .git file is ignored during configuration discovery. An outer .isort.cfg can then be inherited, changing the source paths and classifying a local module as third party. Stop discovery at .git files as well as directories, while retaining local config precedence and the existing Mercurial boundary behavior.

Addresses the reproduced outer-configuration case of #2068. This does not establish the cause of every worktree classification problem in that report.

Validation on Windows with Python 3.12:

  • Eight regression/control cases: two fail against unchanged main; all pass with the fix. Complete unit suite: 629 passed, 5 skipped, with 99.34% branch-enabled coverage; independently rerun with the same result.
  • Actual linked/orphan worktrees and ordinary repositories checked through both the API and CLI. Independent checks also cover separate Git metadata directories, local/empty/unrelated configuration, explicit external settings files and runtime overrides.
  • Full Ruff check/format, flake8 and Linux-platform mypy pass. Changed-file isort and Bandit pass. Full checks retain the same baseline findings: Windows os.mkfifo typing, the existing CRLF formatting fixture, and Bandit's assertion finding in parse.py:407.

Other Python/OS runtimes, mypyc builds and the network-cloning integration suite were not run.

AI disclosure: developed and independently reviewed by Codex agents on behalf of vzer200; no human line-by-line review is claimed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused implementation matches the stated behavior and is covered by relevant regression and control tests.

Review effort: Balanced
Findings: None

What changed in this PR

Stops configuration discovery at Git worktree boundaries while preserving local configuration precedence and Mercurial behavior.

Changes:

  • Recognizes .git files as repository boundaries.
  • Adds regression and control tests for boundary discovery.
  • Updates configuration discovery documentation.
File Description
isort/​settings.py Stops discovery at .git files or directories.
tests/​unit/​test_settings.py Tests Git worktrees, configuration precedence, and Mercurial behavior.
docs/​configuration/​config_files.md Documents supported repository boundary markers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.37%. Comparing base (131f4ad) to head (3d9d949).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2654   +/-   ##
=======================================
  Coverage   99.37%   99.37%           
=======================================
  Files          41       41           
  Lines        3181     3182    +1     
  Branches      686      686           
=======================================
+ Hits         3161     3162    +1     
  Misses         12       12           
  Partials        8        8           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DanielNoord
DanielNoord added this pull request to the merge queue Sep 21, 2026
Merged via the queue into PyCQA:main with commit 03f1ce0 Sep 21, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants