Skip to content

False "Found .git/ in higher parent directory" warning in monorepo setup #1418

@sergeykad

Description

@sergeykad

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working properlyconfirmedPrevent from becoming stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions