Skip to content

fix(git-worktree): detect worktrees where .git is a file, not a directory - #159

Merged
kieranklaassen merged 1 commit into
EveryInc:mainfrom
dalley:fix/worktree-list-git-file-check
Feb 8, 2026
Merged

kieranklaassen merged 1 commit into
EveryInc:mainfrom
dalley:fix/worktree-list-git-file-check

Conversation

@dalley

@dalley dalley commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix list and cleanup commands silently failing to detect any worktrees
  • Change .git existence check from -d (is directory) to -e (exists) on lines 137 and 234
  • In git worktrees, .git is a regular file containing a gitdir: pointer — not a directory — so the -d check always fails

Fixes #158

Test plan

  • Create a worktree with worktree-manager.sh create test-branch
  • Run worktree-manager.sh list and verify the worktree appears
  • Run worktree-manager.sh cleanup and verify the worktree is offered for removal

🤖 Generated with Claude Code

…tory

In git worktrees, .git is a regular file containing a gitdir: pointer
back to the main repository — not a directory. The -d check caused
list and cleanup to silently skip all worktrees, reporting "No
worktrees found". Changed to -e (exists) which handles both cases.

Fixes EveryInc#158

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@kieranklaassen kieranklaassen added the bug Something isn't working label Feb 8, 2026

@kieranklaassen kieranklaassen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TY

@kieranklaassen
kieranklaassen merged commit 0c404f9 into EveryInc:main Feb 8, 2026
@kieranklaassen

Copy link
Copy Markdown
Collaborator

Thanks @dalley! Great bug report and clean fix. The root cause analysis in the issue was spot-on. 👏

kprimdal added a commit to primux-dk/laravel-compound-engineering that referenced this pull request Feb 9, 2026
- Add `sync` command to sync ~/.claude/ personal config to OpenCode/Codex (EveryInc#123)
- Backup existing config files before overwriting (EveryInc#119)
- Remove worktree creation confirmation prompt (EveryInc#144)
- Fix .git file detection in worktrees (use -e instead of -d) (EveryInc#159)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
This was referenced Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[compound-engineering] Bug: git-worktree list/cleanup fails to detect worktrees (.git file vs directory check)

2 participants