Skip to content

fix: create new files in the subtree cwd under --subtree-only#5340

Open
rodboev wants to merge 1 commit into
Aider-AI:mainfrom
rodboev:pr/subtree-new-files
Open

fix: create new files in the subtree cwd under --subtree-only#5340
rodboev wants to merge 1 commit into
Aider-AI:mainfrom
rodboev:pr/subtree-new-files

Conversation

@rodboev

@rodboev rodboev commented Jun 28, 2026

Copy link
Copy Markdown

Summary

Make subtree-only sessions create new relative files inside the current cwd subtree instead of the git root. This covers both unmatched /add paths and model-created files, while keeping tracked-file and non-subtree path semantics unchanged.

Why

--subtree-only already scopes visibility to the current subtree, but new-file creation still resolves from repo root. In monorepos that forces files into the wrong directory even when the whole session is intentionally scoped to a subproject.

Attribution

Scope follows gregid's monorepo report quoted in #3329 from #312 (comment).

Tests

  • python -m pytest tests/basic/test_commands.py::TestCommands::test_cmd_add_subtree_only_creates_unmatched_file_in_cwd tests/basic/test_coder.py::TestCoder::test_allowed_to_edit_subtree_only_creates_new_file_in_cwd tests/basic/test_coder.py::TestCoder::test_allowed_to_edit_without_subtree_only_keeps_repo_root_for_new_files tests/basic/test_coder.py::TestCoder::test_allowed_to_edit_subtree_only_keeps_repo_relative_subtree_paths tests/basic/test_repo.py::TestRepo::test_subtree_only_new_file_path_resolution -v
  • pre-commit run --all-files

Closes #3329

@CLAassistant

CLAassistant commented Jun 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

With --subtree-only files are created in the git root, not the subtree?

2 participants