Skip to content

fix(sync): normalize JSONL path in CommitToSyncBranch for sync-branch mode#1340

Merged
steveyegge merged 1 commit intosteveyegge:mainfrom
olpie101:fix/sync-branch-path-normalization
Jan 27, 2026
Merged

fix(sync): normalize JSONL path in CommitToSyncBranch for sync-branch mode#1340
steveyegge merged 1 commit intosteveyegge:mainfrom
olpie101:fix/sync-branch-path-normalization

Conversation

@olpie101
Copy link
Contributor

Summary

Fixes bd sync --full failing to commit and push changes when using dolt backend with git-portable mode and sync-branch configured.

Root cause: When sync-branch is configured, findJSONLPath() returns the worktree path (per GH#1103), causing jsonlRelPath in CommitToSyncBranch to contain extra path components (e.g., .git/beads-worktrees/beads-sync/.beads/issues.jsonl). This led to:

  1. hasChangesInWorktree checking the wrong path and always returning "no changes"
  2. commitInWorktree trying to git add the wrong path, failing with exit status 128

Fix: Apply NormalizeBeadsRelPath to strip the extra path components before using the path for change detection and committing. This matches the fix already present in daemon_sync_branch.go for GH#810.

Changes

  • internal/syncbranch/worktree.go: Normalize jsonlRelPath before constructing worktreeJSONLPath and passing to commitInWorktree

Test plan

  • Existing TestCommitToSyncBranch tests pass
  • Manual testing: bd sync --full on repo with dolt backend + git-portable mode + sync-branch now successfully commits and pushes

Generated with Claude Code

… mode

When sync-branch is configured, findJSONLPath() returns the worktree
path (per GH#1103), causing jsonlRelPath to contain extra path
components like ".git/beads-worktrees/beads-sync/.beads/issues.jsonl".

This caused two issues in CommitToSyncBranch:
1. hasChangesInWorktree checked the wrong path, always returning
   "no changes" even when changes existed
2. commitInWorktree tried to git add the wrong path, failing with
   exit status 128

The fix applies NormalizeBeadsRelPath (which strips path components
before .beads/) to get the correct relative path. This matches the
fix already present in daemon_sync_branch.go for GH#810.

Fixes: bd sync --full not committing/pushing with dolt backend +
git-portable mode + sync-branch configuration.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@olpie101
Copy link
Contributor Author

The lint error is pre-existing, also present on main

Copy link
Owner

@steveyegge steveyegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - clean fix applying NormalizeBeadsRelPath() to handle worktree path normalization. Tests pass, lint failure is pre-existing on main (unrelated gosec G304 in migrate_dolt.go).

@steveyegge steveyegge merged commit e78bcc0 into steveyegge:main Jan 27, 2026
6 of 7 checks passed
groblegark pushed a commit to groblegark/beads that referenced this pull request Jan 31, 2026
… mode (steveyegge#1340)

When sync-branch is configured, findJSONLPath() returns the worktree
path (per GH#1103), causing jsonlRelPath to contain extra path
components like ".git/beads-worktrees/beads-sync/.beads/issues.jsonl".

This caused two issues in CommitToSyncBranch:
1. hasChangesInWorktree checked the wrong path, always returning
   "no changes" even when changes existed
2. commitInWorktree tried to git add the wrong path, failing with
   exit status 128

The fix applies NormalizeBeadsRelPath (which strips path components
before .beads/) to get the correct relative path. This matches the
fix already present in daemon_sync_branch.go for GH#810.

Fixes: bd sync --full not committing/pushing with dolt backend +
git-portable mode + sync-branch configuration.

Co-authored-by: Claude Opus 4.5 <[email protected]>
groblegark pushed a commit to groblegark/beads that referenced this pull request Jan 31, 2026
… mode (steveyegge#1340)

When sync-branch is configured, findJSONLPath() returns the worktree
path (per GH#1103), causing jsonlRelPath to contain extra path
components like ".git/beads-worktrees/beads-sync/.beads/issues.jsonl".

This caused two issues in CommitToSyncBranch:
1. hasChangesInWorktree checked the wrong path, always returning
   "no changes" even when changes existed
2. commitInWorktree tried to git add the wrong path, failing with
   exit status 128

The fix applies NormalizeBeadsRelPath (which strips path components
before .beads/) to get the correct relative path. This matches the
fix already present in daemon_sync_branch.go for GH#810.

Fixes: bd sync --full not committing/pushing with dolt backend +
git-portable mode + sync-branch configuration.

Co-authored-by: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments