Skip to content

[beman-tidy] Support running on a bare repository with worktrees (#186) - #383

Open
neatudarius wants to merge 2 commits into
mainfrom
issue-186-bare-repo-worktree
Open

neatudarius wants to merge 2 commits into
mainfrom
issue-186-bare-repo-worktree

Conversation

@neatudarius

Copy link
Copy Markdown
Member

Context

Updates

  • A bare repository path resolves to its only worktree; with none or several, beman-tidy exits 1 and lists the worktrees (beman_tidy/lib/utils/git.py).
  • Tests for a bare clone with worktrees (tests/lib/utils/test_git.py).

Notes

  • Normal clones are unaffected; only bare repositories take the new path. Start reviewing at open_worktree_repo.

Testing

  • uv run pytest tests/: 160 passed, 28 skipped; uv run ruff check --diff: clean.
  • Same results as main on the stamped exemplar (--require-all) and all 22 libraries.

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.

🟡 Changes recommended

Worktree discovery mishandles quoted or escaped paths and counts missing locked checkouts, causing valid bare-repository setups to be rejected.

2 open issues
What changed in this PR

Extends beman-tidy’s worktree support to accept bare repository paths, building on the default-branch fallback added in #246.

Changes:

  • Resolves a bare repository to its sole checked-out worktree.
  • Reports an error when no worktree or multiple worktrees are available.
  • Adds tests for direct worktree access and bare repositories with zero, one, or multiple worktrees.
File Description
tests/​lib/​utils/​test_git.py Adds bare-clone fixtures and worktree resolution tests.
beman_tidy/​lib/​utils/​git.py Adds worktree discovery, bare repository resolution, and targeted error handling.

Review effort: Balanced

Comment thread beman_tidy/lib/utils/git.py Resolved
Comment thread beman_tidy/lib/utils/git.py Resolved
The worktree case was fixed by #246; this resolves a bare repository to its only worktree and reports the worktrees otherwise.
@neatudarius
neatudarius force-pushed the issue-186-bare-repo-worktree branch from 5ce511d to 774f2b1 Compare November 18, 2026 22:39
@neatudarius
neatudarius marked this pull request as ready for review November 18, 2026 22:42
@neatudarius

Copy link
Copy Markdown
Member Author

@steve-downey , is this working for you?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants