fix: bd sync fails with exit 128 in bare repo worktrees (GH#827)
Two fixes for bare repo worktree setups: 1. fork_protection.go: Use git.GetGitDir() instead of hardcoding .git In worktrees, .git is a file containing gitdir path, not a directory. Using GetGitDir() handles this correctly. 2. sync_git.go: Simplify gitHasBeadsChanges to use absolute paths The previous code used git -C main-repo-root status, but in bare repo worktrees GetMainRepoRoot() returns the parent of the bare repo which is not a valid working tree. Using absolute paths without -C lets git find the repo from cwd, which always works. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
95f14fa827
commit
363c5a3819
@@ -43,8 +43,15 @@ func ensureForkProtection() {
|
||||
return // Not a fork of beads, user's own project
|
||||
}
|
||||
|
||||
// Get actual git directory (handles worktrees where .git is a file) (GH#827)
|
||||
gitDir, err := git.GetGitDir()
|
||||
if err != nil {
|
||||
debug.Printf("fork protection: failed to get git dir: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Check if already excluded
|
||||
excludePath := filepath.Join(gitRoot, ".git", "info", "exclude")
|
||||
excludePath := filepath.Join(gitDir, "info", "exclude")
|
||||
if isAlreadyExcluded(excludePath) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user