fix: respect sync.remote config in bd sync (GH#872, bd-ypvj)

The sync.remote config was being set via `bd config set sync.remote <name>`
but `bd sync` was still using 'origin' for git pull/push operations.

Changes:
- Updated gitPull() and gitPush() in sync_git.go to accept a configuredRemote
  parameter that takes precedence over git's branch tracking config
- Updated sync.go to read sync.remote config and pass it to gitPull/gitPush
- Updated daemon_sync.go to read sync.remote config for all daemon sync ops
- Added user-facing messages to show which remote is being used

🤖 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:
dave
2026-01-03 13:24:28 -08:00
committed by Steve Yegge
parent 631b067c1c
commit 6c4b67f65d
3 changed files with 111 additions and 60 deletions

View File

@@ -486,9 +486,10 @@ func performExport(ctx context.Context, store storage.Storage, autoCommit, autoP
}
log.log("Committed changes")
// Auto-push if enabled
// Auto-push if enabled (GH#872: use sync.remote config)
if autoPush {
if err := gitPush(exportCtx); err != nil {
configuredRemote, _ := store.GetConfig(exportCtx, "sync.remote")
if err := gitPush(exportCtx, configuredRemote); err != nil {
log.log("Push failed: %v", err)
return
}
@@ -597,9 +598,10 @@ func performAutoImport(ctx context.Context, store storage.Storage, skipGit bool,
return
}
// If sync branch not configured, use regular pull
// If sync branch not configured, use regular pull (GH#872: use sync.remote config)
if !pulled {
if err := gitPull(importCtx); err != nil {
configuredRemote, _ := store.GetConfig(importCtx, "sync.remote")
if err := gitPull(importCtx, configuredRemote); err != nil {
backoff := RecordSyncFailure(beadsDir, err.Error())
log.log("Pull failed: %v (backoff: %v)", err, backoff)
return
@@ -800,9 +802,10 @@ func performSync(ctx context.Context, store storage.Storage, autoCommit, autoPus
return
}
// If sync branch not configured, use regular pull
// If sync branch not configured, use regular pull (GH#872: use sync.remote config)
if !pulled {
if err := gitPull(syncCtx); err != nil {
configuredRemote, _ := store.GetConfig(syncCtx, "sync.remote")
if err := gitPull(syncCtx, configuredRemote); err != nil {
log.log("Pull failed: %v", err)
return
}
@@ -889,8 +892,10 @@ func performSync(ctx context.Context, store storage.Storage, autoCommit, autoPus
}
}
// GH#872: use sync.remote config
if autoPush && autoCommit {
if err := gitPush(syncCtx); err != nil {
configuredRemote, _ := store.GetConfig(syncCtx, "sync.remote")
if err := gitPush(syncCtx, configuredRemote); err != nil {
log.log("Push failed: %v", err)
return
}