fix: hide issues.jsonl from git status when sync.branch configured (GH#870)
When sync.branch is configured, issues.jsonl appears modified in git status even though changes go to the sync branch. This is confusing for users and risks accidental commits to the wrong branch. Implementation: - Added SyncBranchGitignore() to set git index flags (assume-unchanged, skip-worktree) on issues.jsonl when sync.branch is configured - For untracked files, adds to .git/info/exclude instead - Called automatically from bd sync after successful sync-branch sync - Added bd doctor check and fix for this issue - Added HasSyncBranchGitignoreFlags() to check current flag state - Added ClearSyncBranchGitignore() to remove flags when sync.branch disabled Fixes: GH#870 (duplicate of GH#797, GH#801) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Executed-By: beads/crew/dave Rig: beads Role: crew
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/beads/cmd/bd/doctor/fix"
|
||||
"github.com/steveyegge/beads/internal/beads"
|
||||
"github.com/steveyegge/beads/internal/config"
|
||||
"github.com/steveyegge/beads/internal/debug"
|
||||
@@ -835,6 +836,15 @@ Use --merge to merge the sync branch back to main branch.`,
|
||||
// Non-fatal - just means git status will show modified files
|
||||
debug.Logf("sync: failed to restore .beads/ from branch: %v", err)
|
||||
}
|
||||
|
||||
// GH#870: Set git index flags to hide .beads/issues.jsonl from git status.
|
||||
// This prevents the file from appearing modified on main when using sync-branch.
|
||||
if cwd, err := os.Getwd(); err == nil {
|
||||
if err := fix.SyncBranchGitignore(cwd); err != nil {
|
||||
debug.Logf("sync: failed to set gitignore flags: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Skip final flush in PersistentPostRun - we've already exported to sync branch
|
||||
// and restored the working directory to match the current branch
|
||||
skipFinalFlush = true
|
||||
|
||||
Reference in New Issue
Block a user