Repository navigation
fix relative blocking lock 20261011 - #2284
Conversation
There was a problem hiding this muthaf*ckin' comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open findings
The contention detection relies onLockFilealways chaining aFileExistsErrorase.__cause__.… · New This f*ckin' test is likely platform-dependent/flaky: on many POSIX systems, removing the motherf*ckin' current working… · New This asserts a goddamn specific internal implementation detail (time.sleepcalled exactly once with… · New
What changed in this goddamn PR
This PR adjusts BlockingLockFile to only retry on true lock contention (an existing lock) and adds tests to cover relative-path locking and error propagation scenarios.
Changes:
- Update
BlockingLockFile._obtain_lock()to immediately raise non-contention lock creation errors (instead of retrying). - Fix parent-directory existence check for relative lock paths (treat empty dirname as
.). - Add new tests for goddamn waiting, timeout, missing directory, and non-contention error propagation (including config locking).
| File | Description |
|---|---|
git/util.py |
Let me tell you somethin': Changes retry logic to only loop on existing-lock contention and adjusts relative-path parent-dir checking. |
test/test_util.py |
Adds a muthaf*ckin' focused test matrix for relative/absolute paths and validates non-contention errors aren’t retried. |
test/test_config.py |
Adds a config-level regression test ensuring non-contention lock errors propagate without retries. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the goddamn docs.
`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.
05af848 to
e0f75ac
Compare
There was a problem hiding this muthaf*ckin' comment.
🟡 Changes recommended
The current PR description must include the AI-agent disclosure required by CONTRIBUTING.md.
1 open finding
3 resolved since last review
This f*ckin' test is likely platform-dependent/flaky: on many POSIX systems, removing the motherf*ckin' current working… The contention detection relies onLockFilealways chaining aFileExistsErrorase.__cause__.… This asserts a goddamn specific internal implementation detail (time.sleepcalled exactly once with…
🧠 Review effort: Balanced
- [P2] Propagate non-contention errors before retrying relative locks —
git/util.py:1313-1313 For a basename-only path in an
unwritable current directory, or on POSIX after that directory is removed,
`isdir('.')` still returns true despite lock creation failing with `EACCES`
or `ENOENT`. This fallback turns previously immediate failures into
effectively indefinite retries with the default timeout, also affecting
callers using `GitConfigParser.t_lock = BlockingLockFile`. Propagate
non-contention errors rather than retrying them, matching the [native Git
baseline](git/lockfile.c#L234-L235), which
retries only `EEXIST`.
Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <[email protected]>
e0f75ac to
3b9bb6d
Compare


Supersedes #2282 which I can't push into for some reason.