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:
Damir Vandic
2026-01-19 19:11:16 +01:00
committed by GitHub
parent 065ca3d6af
commit b09aee377f
3 changed files with 124 additions and 0 deletions

View File

@@ -683,3 +683,10 @@ func FixSyncBranchGitignore() error {
return fix.SyncBranchGitignore(cwd)
}
// SetSyncBranchGitignoreFlags sets git index flags on .beads/*.jsonl files.
// This is called directly by init when --branch is specified, bypassing the
// GetFromYAML() check since the in-memory config may not be updated yet.
func SetSyncBranchGitignoreFlags(path string) error {
return fix.SyncBranchGitignore(path)
}