2 Commits

Author SHA1 Message Date
Steve Yegge
cf4aff1cb4 fix: bypass gitHasBeadsChanges when using sync-branch (#812)
When using sync-branch with aggressive gitignore on code branches
(.beads/* ignored), gitHasBeadsChanges() returns false because git
does not track the files. This caused bd sync to skip CommitToSyncBranch
entirely, even though CommitToSyncBranch has its own internal change
detection that checks the worktree where gitignore is different.

The fix bypasses gitHasBeadsChanges when useSyncBranch is true, letting
CommitToSyncBranch determine if there are actual changes in the worktree.

Closes #812

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 18:04:26 -08:00
Charles P. Cross
e309b1c1aa fix(sync): respect sync.branch config when no upstream tracking (#640)
* fix(sync): respect sync.branch config when no upstream tracking

When sync.branch is explicitly configured, bd sync should use worktree-based
sync even if the current branch has no upstream tracking. This fixes the
issue where jj (Jujutsu) colocated repos and git worktrees without upstream
would incorrectly fall back to --from-main mode.

The fix checks for sync.branch configuration BEFORE the upstream check,
allowing the configured sync branch to take precedence.

Affected workflows:
- jj colocated repos (always use detached HEAD)
- Git worktrees not tracking a remote
- Temporary checkouts for testing

Fixes #638

* test(sync): add regression tests for sync.branch priority over upstream check

Add tests verifying that when sync.branch is configured, bd sync does NOT
fall back to --from-main mode even without upstream tracking. This covers:

- sync.branch configured without upstream (should use worktree sync)
- No sync.branch and no upstream (should fallback to from-main)
- Detached HEAD with sync.branch (jj workflow, should use worktree sync)

These tests ensure the fix for GH#638 doesn't regress.

---------

Co-authored-by: Charles P. Cross <cpdata@users.noreply.github.com>
2025-12-19 17:52:27 -08:00