Skip to content

feat: add --remote flag to bd dolt push/pull + per-remote credential routing#3211

Open
harry-miller-trimble wants to merge 1 commit intogastownhall:mainfrom
harry-miller-trimble:upstream/remote-flag
Open

feat: add --remote flag to bd dolt push/pull + per-remote credential routing#3211
harry-miller-trimble wants to merge 1 commit intogastownhall:mainfrom
harry-miller-trimble:upstream/remote-flag

Conversation

@harry-miller-trimble
Copy link
Copy Markdown
Contributor

Summary

Adds --remote flag to bd dolt push and bd dolt pull commands, enabling push/pull to target a specific named remote. Also refactors credential routing to be per-remote-aware.

Changes

Interface (internal/storage/remote.go)

  • Add PushRemote(ctx, remote, force) and PullRemote(ctx, remote) to RemoteStore interface

Core (internal/storage/dolt/store.go)

  • Refactor Push/ForcePush/Pull to delegate to internal pushToRemote/pullFromRemote
  • Add credentialsForRemote() helper — only returns creds when target matches default remote

Credentials (internal/storage/dolt/credentials.go)

  • shouldUseCLIForCloudAuth now per-scheme-aware: Azure env vars only trigger CLI for az:// remotes, not dolthub://
  • New cloudAuthSchemeMap and envPrefixesForRemoteURL() for scheme-to-env mapping

CLI (cmd/bd/dolt.go)

  • Add --remote flag to doltPushCmd and doltPullCmd

Backwards Compatibility

  • Push(ctx)/Pull(ctx)/ForcePush(ctx) signatures unchanged — all 11+ callers unaffected
  • No --remote flag = exact same behavior as today
  • PushTo/PullFrom for federation peers unchanged

Files changed (7 files, +363/-133)

Rebased from fork PR harry-miller-trimble#34

Add PushRemote/PullRemote methods to RemoteStore interface, allowing
push/pull to target a specific named remote instead of the default.

Implementation:
- Refactor Push/ForcePush/Pull to delegate to internal pushToRemote/
  pullFromRemote methods with parameterized remote name
- Parameterize credential routing (isGitProtocolRemote,
  shouldUseCLIForCredentials, shouldUseCLIForCloudAuth) to accept
  remote name instead of using s.remote
- Make shouldUseCLIForCloudAuth per-scheme-aware: Azure env vars only
  trigger CLI routing for az:// remotes, not dolthub:// remotes
- Add credentialsForRemote() helper that only returns creds when the
  target remote matches the default remote (prevents sending wrong
  creds to wrong host)
- Add --remote flag to doltPushCmd and doltPullCmd in CLI
- Implement PushRemote/PullRemote on EmbeddedDoltStore

Backwards compatibility:
- Push(ctx)/Pull(ctx)/ForcePush(ctx) signatures unchanged
- No --remote flag = exact same behavior as today
- PushTo/PullFrom for federation peers unchanged

Closes: bd-4v3

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant