Description
When following the monorepo documentation, I configure repo_dir = ".." to point from my package directory to the repository root. PSR then emits this warning:
WARNING:root:Found .git/ in higher parent directory rather than provided in configuration.
The warning is misleading because the configuration is correct—.. does resolve to the repository root.
Cause
In semantic_release/cli/config.py, the verify_git_repo_dir validator compares paths without resolving them:
if dir_path.absolute() != found_path:
logging.warning(...)
Path("..").absolute() returns /path/to/package/.. rather than /path/to/repo, so the comparison fails even when both paths point to the same directory.
Suggested Fix
if dir_path.resolve() != found_path.resolve():
Reproduction
Directory structure:
my-monorepo/ # .git/ here
├── package-a/
│ └── pyproject.toml # repo_dir = ".."
Commands:
cd package-a
semantic-release version --print
# WARNING:root:Found .git/ in higher parent directory...
Documented Workflow
The monorepo guide instructs users to run PSR from the package subdirectory:
"To release a package, change your current working directory to the package directory and execute PSR's semantic-release version."
In this workflow, the .git/ directory will always be in a parent directory. The warning contradicts the documented approach.
Environment
- python-semantic-release: 10.5.3
- Python: 3.12
- OS: Linux
Description
When following the monorepo documentation, I configure
repo_dir = ".."to point from my package directory to the repository root. PSR then emits this warning:The warning is misleading because the configuration is correct—
..does resolve to the repository root.Cause
In
semantic_release/cli/config.py, theverify_git_repo_dirvalidator compares paths without resolving them:Path("..").absolute()returns/path/to/package/..rather than/path/to/repo, so the comparison fails even when both paths point to the same directory.Suggested Fix
Reproduction
Directory structure:
Commands:
Documented Workflow
The monorepo guide instructs users to run PSR from the package subdirectory:
In this workflow, the
.git/directory will always be in a parent directory. The warning contradicts the documented approach.Environment