MCPcopy Create free account
hub / github.com/entireio/git-sync / Sync

Method Sync

client.go:63–76  ·  view source on GitHub ↗

Sync executes a sync between two remotes.

(ctx context.Context, req SyncRequest)

Source from the content-addressed store, hash-verified

61
62// Sync executes a sync between two remotes.
63func (c *Client) Sync(ctx context.Context, req SyncRequest) (SyncResult, error) {
64 if err := req.Validate(); err != nil {
65 return SyncResult{}, err
66 }
67 cfg, err := c.buildSyncConfig(ctx, req.Source, req.Target, req.Scope, req.Policy, req.CollectStats, false)
68 if err != nil {
69 return SyncResult{}, err
70 }
71 result, err := internalbridge.Run(ctx, cfg)
72 if err != nil {
73 return SyncResult{}, fmt.Errorf("sync: %w", err)
74 }
75 return internalbridge.FromSyncResult(result), nil
76}
77
78// Replicate executes source-authoritative relay-only replication between two remotes.
79func (c *Client) Replicate(ctx context.Context, req SyncRequest) (SyncResult, error) {

Callers 5

ReplicateMethod · 0.95
ExampleClient_SyncFunction · 0.45
newSyncLikeCmdFunction · 0.45
executeScenarioFunction · 0.45

Calls 4

buildSyncConfigMethod · 0.95
RunFunction · 0.92
FromSyncResultFunction · 0.92
ValidateMethod · 0.45

Tested by 2

ExampleClient_SyncFunction · 0.36