GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix relative blocking lock 20261011 by Byron · Pull Request #2284 · gitpython-developers/GitPython

Conversation

@Byron

@Byron Byron commented Oct 14, 2026

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI balanced review requested due to automatic review settings October 14, 2026 08:20
@Byron Byron mentioned this pull request Oct 14, 2026
fix(util): wait for contended locks with relative filenames #2282
Closed
Copilot started reviewing on behalf of Byron October 14, 2026 08:37
View session
Copilot AI reviewed Oct 14, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
  • Medium severity The contention detection relies on LockFile always chaining a FileExistsError as e.__cause__.… · New
  • Medium severity This test is likely platform-dependent/flaky: on many POSIX systems, removing the current working… · New
  • Low severity This asserts a specific internal implementation detail (time.sleep called exactly once with… · New
What changed in this 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 waiting, timeout, missing directory, and non-contention error propagation (including config locking).
File Description
git/​util.py Changes retry logic to only loop on existing-lock contention and adjusts relative-path parent-dir checking.
test/​test_util.py Adds a 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 docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread git/util.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/test_util.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/test_util.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@FanWu-ai @Byron
fix(util): wait for contended locks with relative filenames
76150aa
`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.
@Byron
Byron force-pushed the fix-relative-blocking-lock-20261011 branch from 05af848 to e0f75ac Compare October 14, 2026 10:00
Copilot AI balanced review requested due to automatic review settings October 14, 2026 10:00
Copilot started reviewing on behalf of Byron October 14, 2026 10:05
View session
Copilot AI reviewed Oct 14, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The current PR description must include the AI-agent disclosure required by CONTRIBUTING.md.

1 open finding
  • Low severity Add required AI-agent disclosure to PR description · New
3 resolved since last review
  • Medium severity This test is likely platform-dependent/flaky: on many POSIX systems, removing the current working…
  • Medium severity The contention detection relies on LockFile always chaining a FileExistsError as e.__cause__.…
  • Low severity This asserts a specific internal implementation detail (time.sleep called exactly once with…

🧠 Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread git/util.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Byron @codex
review
3b9bb6d
- [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]>
@Byron
Byron force-pushed the fix-relative-blocking-lock-20261011 branch from e0f75ac to 3b9bb6d Compare October 14, 2026 10:08
Copilot AI balanced review requested due to automatic review settings October 14, 2026 10:08
Copilot started reviewing on behalf of Byron October 14, 2026 10:16
View session
Copilot AI reviewed Oct 14, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation matches the intended behavior and has comprehensive regression coverage.

0 open findings

1 resolved since last review
  • Low severity Add required AI-agent disclosure to PR description

🧠 Review effort: Balanced

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Byron
Byron merged commit 109017e into main Oct 14, 2026
51 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron deleted the fix-relative-blocking-lock-20261011 branch October 14, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Byron @FanWu-ai
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.