Skip to content

fix: keep native working directories for SCM version queries - #316

Open
mayankdhingra02 wants to merge 1 commit into
pdm-project:mainfrom
mayankdhingra02:fix-scm-native-cwd
Open

mayankdhingra02 wants to merge 1 commit into
pdm-project:mainfrom
mayankdhingra02:fix-scm-native-cwd

Conversation

@mayankdhingra02

@mayankdhingra02 mayankdhingra02 commented Nov 1, 2026 •

Copy link
Copy Markdown

MSYS Git can return a POSIX repository path that native Windows Python cannot use as a subprocess working directory. Keep the caller's already-working directory for subsequent repository-wide Git queries, preserving the existing repository discovery and shallow-clone diagnostic.

Fixes #197.

Adds 36 regression/control cases for tagged, untagged, dirty and post-tag repositories; nested and symlink paths; wheel/editable metadata; shallow clones; and non-repository/bare-repository inputs. The MSYS tests change only rev-parse --show-toplevel output; all Git commands and metadata builds are real.

Validation on macOS:

  • Full pdm run pytest -vv tests: CPython 3.9–3.14 each 131 passed, 1 skipped; PyPy 3.9: 128 passed, 4 skipped. Includes Git and Mercurial tests.
  • The new cases produce 16 failures and 20 passing controls on the unchanged base, then all 36 pass with the fix.
  • pre-commit run --all-files, wheel/sdist/editable builds, Twine checks and strict MkDocs build pass.

Native Windows/MSYS and Linux execution remain for CI; the local regression emulates the reported path spelling. Python 3.12's tar extraction warning also occurs on the unchanged base.

The Netlify preview currently fails while rendering api.md with Highlight.__init__() missing its md argument. The same failure occurs on the unchanged base and this branch with all 36 logged Netlify package versions and Python 3.10.22 on macOS. The project's locked strict MkDocs build passes locally.

MSYS Git may return a repository path that native Python cannot open. Use
its caller-provided working directory for repository-wide queries after
the existing repository discovery and shallow-clone check.

Cover metadata builds and Git states from root, nested and symlink paths,
including emulated MSYS output and native-path controls.

Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
@netlify

netlify Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for pdm-backend-docs failed. Why did it fail? →

Name Link
🔨 Latest commit f893740
🔍 Latest deploy log https://app.netlify.com/projects/pdm-backend-docs/deploys/6ae7c79e3fba2926ab4d848a

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.

NotADirectoryError: [WinError 267] The directory name is invalid when installing via pip install -e . using msys2 git.

1 participant