fix: set git index flags on init when sync-branch is configured (#1158)
Fresh clones with sync-branch configured in .beads/config.yaml would show .beads/issues.jsonl as modified in git status because the git index flags (skip-worktree, assume-unchanged) are local-only and don't transfer via clone. This fix ensures bd init sets these flags in two scenarios: 1. `bd init --branch <name>` - when user explicitly sets sync branch 2. `bd init` on cloned repo - when sync-branch already exists in config.yaml Added SetSyncBranchGitignoreFlags() helper and two tests for coverage.
This commit is contained in:
@@ -542,6 +542,23 @@ With --stealth: configures per-repository git settings for invisible beads usage
|
||||
}
|
||||
}
|
||||
|
||||
// Set git index flags to hide JSONL from git status when sync.branch is configured.
|
||||
// These flags are local-only (don't transfer via git clone), so each clone needs them set.
|
||||
// This fixes the issue where fresh clones show .beads/issues.jsonl as modified.
|
||||
if isGitRepo() {
|
||||
if branch != "" {
|
||||
// --branch flag was passed: set flags directly (in-memory config not updated yet)
|
||||
if err := doctor.SetSyncBranchGitignoreFlags(cwd); err != nil && !quiet {
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to set git index flags: %v\n", err)
|
||||
}
|
||||
} else {
|
||||
// No --branch flag: check if sync-branch exists in config.yaml (cloned repo scenario)
|
||||
if err := doctor.FixSyncBranchGitignore(); err != nil && !quiet {
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to set git index flags: %v\n", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add "landing the plane" instructions to AGENTS.md and @AGENTS.md
|
||||
// Skip in stealth mode (user wants invisible setup) and quiet mode (suppress all output)
|
||||
if !stealth {
|
||||
|
||||
Reference in New Issue
Block a user