Skip to content

fix: handle .bare/worktrees/ layout in GetWorktreeID#669

Open
mvanhorn wants to merge 1 commit intoentireio:mainfrom
mvanhorn:osc/431-fix-worktreeid-bare-repo
Open

fix: handle .bare/worktrees/ layout in GetWorktreeID#669
mvanhorn wants to merge 1 commit intoentireio:mainfrom
mvanhorn:osc/431-fix-worktreeid-bare-repo

Conversation

@mvanhorn
Copy link
Contributor

Summary

Fixes #431

  • GetWorktreeID now checks both .git/worktrees/ and .bare/worktrees/ markers when extracting the worktree ID from a gitdir path
  • Supports the widely-used bare repo + worktree layout pattern where repos use .bare/ instead of .git/

Changes

  • cmd/entire/cli/paths/worktree.go - Added .bare/worktrees/ as a fallback marker in GetWorktreeID
  • cmd/entire/cli/paths/worktree_test.go - Added test cases for bare repo worktree layout

Test plan

  • Existing tests pass
  • New test cases cover .bare/worktrees/ paths
  • gofmt and go vet clean

This contribution was developed with AI assistance (Claude Code).

GetWorktreeID only checked for .git/worktrees/ marker when extracting
the worktree identifier from gitdir paths. Bare repo + worktree layouts
use .bare/worktrees/<name> instead, causing "unexpected gitdir format"
errors. Check both markers to support both layouts.

Fixes entireio#431

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

GetWorktreeID fails with bare repo + worktree layout (.bare/worktrees/)

1 participant