Skip to content

Commit

Permalink
Sync from custom remote (#2447)
Browse files Browse the repository at this point in the history
Introduce a new `--remote` flag that allows customizing a remote name to
fetch the commits from. By default we still sync from local.
  • Loading branch information
unmultimedio authored Sep 19, 2023
1 parent 10ad623 commit ebec930
Show file tree
Hide file tree
Showing 14 changed files with 534 additions and 480 deletions.
8 changes: 8 additions & 0 deletions private/buf/bufsync/bufsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ func NewSyncer(
// SyncerOption configures the creation of a new Syncer.
type SyncerOption func(*syncer) error

// SyncerWithRemote configures a Syncer with a resumption using a SyncPointResolver.
func SyncerWithRemote(remoteName string) SyncerOption {
return func(s *syncer) error {
s.remote = remoteName
return nil
}
}

// SyncerWithModule configures a Syncer to sync a module in the specified module directory, with an
// optional module override.
//
Expand Down
8 changes: 3 additions & 5 deletions private/buf/bufsync/commits_to_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ func TestCommitsToSyncWithNoPreviousSyncPoints(t *testing.T) {
for _, syncableCommit := range syncableCommits {
assert.NotEmpty(t, syncableCommit.commit.Hash().Hex())
mockBSRChecker.markSynced(syncableCommit.commit.Hash().Hex())
if withOverride {
assert.Equal(t, moduleIdentityOverride.IdentityString(), syncableCommit.module.ModuleIdentity().IdentityString())
} else {
assert.Equal(t, moduleIdentityInHEAD.IdentityString(), syncableCommit.module.ModuleIdentity().IdentityString())
}
assert.NotNil(t, syncableCommit.module)
// no need to assert syncableCommit.module.ModuleIdentity, it's not renamed because it's
// not used when syncing.
}
})
}(tc)
Expand Down
135 changes: 0 additions & 135 deletions private/buf/bufsync/rebuild_module_test.go

This file was deleted.

Loading

0 comments on commit ebec930

Please sign in to comment.