fix(util): wait for contended locks with relative filenames by FanWu-ai · Pull Request #2282 · gitpython-developers/GitPython
Repository navigation
fix(util): wait for contended locks with relative filenames - #2282
Closed
FanWu-ai wants to merge 2 commits into gitpython-developers:main from FanWu-ai:fix-relative-blocking-lock-20261011
Closed
fix(util): wait for contended locks with relative filenames #2282 FanWu-ai wants to merge 2 commits into gitpython-developers:main from FanWu-ai:fix-relative-blocking-lock-20261011
Conversation
FanWu-ai commented Oct 11, 2026 · edited Loading
Copy link Copy Markdown
Contributor
BlockingLockFile('resource') fails immediately when another holder owns the lock, reporting that its directory is missing. dirname('resource.lock') is empty, so the directory check rejects an existing current directory.
Use the current directory when the lock path has no directory component. Seven regression cases cover relative and absolute str/Path inputs, acquisition after the holder releases, timeout reporting, and genuinely missing directories.
Validation on Linux, CPython 3.12.14 and Git 2.52.0:
- Pristine full suite: 1,689 passed; new cases before the fix: 4 failed, 3 passed.
- Final full suite: 1,696 passed, 89 unchanged conditional skips, 1 existing xfail, 64 subtests passed; 92% coverage.
- All nine pinned hooks, mypy (46 files), basedpyright with warnings enabled, clean docs, wheel/sdist builds, strict Twine and whitespace checks pass.
The skips cover platform/filesystem-specific cases; the existing xfail concerns shallow submodules. The existing environment-variable path deprecation warning remains. Native Windows, macOS and Cygwin have not been run locally.
Follow-up CI compatibility repair (2026-10-12, commit 62fe322):
- The original hosted run exposed four test failures on Python 3.8-3.10 (including Cygwin 3.9): string-based mock lookup followed the legacy
git.utilalias togit.index.utilinstead of the intended module. - Patch the already imported
timemodule'ssleepattribute directly. This is a one-line test-only change; the production fix and every assertion remain unchanged. - Fresh pristine full suites on Linux, CPython 3.8.20/3.9.25/3.10.22/3.12.14: 1,689 passed per interpreter. Final full suites: 1,696 passed per interpreter, with the same 89 skips and one existing xfail; 64 subtests pass where reported (3.10/3.12).
- On 3.8/3.9/3.10, the corrected tests against the original production code still give 4 failed and 3 passed, preserving regression sensitivity.
- Final nine pinned hooks, mypy on 3.9/3.10/3.12, basedpyright with warnings enabled, clean documentation builds on 3.9/3.10/3.12, wheel/sdist builds, strict Twine and whitespace checks all pass.
- The latest five hosted workflows for this commit currently report
action_requiredwith no jobs started. Hosted CI is awaiting approval, not passing: Python package run . Earlier hosted results are not evidence that this new commit passed.
This contribution was prepared by OpenAI Codex, an AI agent operating through FanWu-ai's account. No human review or approval is claimed.
fix(util): wait for contended locks with relative filenames
ac29284
`BlockingLockFile('resource')` incorrectly treats the empty `dirname` of
`resource.lock` as a missing directory when another holder owns the lock.
Use `os.curdir` for that case so the retry and timeout paths work normally.
Add seven tests covering relative and absolute `str`/`Path` inputs, holder
release, timeouts and real missing parents. The complete Linux/Python 3.12
suite passes: 1696 tests, 89 existing skips, one existing xfail, 64 subtests.
Pinned hooks, mypy, basedpyright, docs, builds and strict Twine also pass.
Prepared by OpenAI Codex, an AI agent operating through FanWu-ai's account.
FanWu-ai
marked this pull request as ready for review
October 11, 2026 18:09
Byron
requested a balanced review from Copilot
October 12, 2026 05:48
Copilot started reviewing on behalf of
Byron
October 12, 2026 05:52
View session
Copilot PR reviewer Copilot
AI
reviewed Oct 12, 2026
View reviewed changes
Copilot
AI
left a comment
Copy link Copy Markdown
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
🟢 Approval recommended
The focused fix correctly addresses the failure and is comprehensively covered by regression tests.
0 open findings
What changed in this PRFixes relative BlockingLockFile paths by treating an empty parent path as the current directory.
Changes:
- Corrects lock-directory validation for relative filenames.
- Adds seven regression cases covering path types, waiting, timeouts, and missing directories.
| File | Description |
|---|---|
git/util.py |
Uses the current directory for parentless lock paths. |
test/test_util.py |
Adds regression coverage for blocking lock behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
test(util): patch sleep portably on older Python versions
62fe322
FanWu-ai
marked this pull request as ready for review
October 12, 2026 09:13
Byron
mentioned this pull request
Oct 14, 2026
fix relative blocking lock 20261011
#2284
Merged
Byron commented Oct 14, 2026
Copy link Copy Markdown
Member
|
Closed in favor of #2284 , which is the same but with my commit on top. |