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

Function ExampleClient_Sync

example_test.go:10–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8)
9
10func ExampleClient_Sync() {
11 client := gitsync.New(gitsync.Options{
12 HTTPClient: &http.Client{},
13 Auth: gitsync.StaticAuthProvider{
14 Source: gitsync.EndpointAuth{Token: "source-token"},
15 Target: gitsync.EndpointAuth{Token: "target-token"},
16 },
17 })
18
19 if _, err := client.Sync(context.Background(), gitsync.SyncRequest{
20 Source: gitsync.Endpoint{URL: "https://github.example/source/repo.git"},
21 Target: gitsync.Endpoint{URL: "https://git.example/target/repo.git"},
22 Scope: gitsync.RefScope{Branches: []string{"main"}},
23 Policy: gitsync.SyncPolicy{
24 IncludeTags: true,
25 Protocol: gitsync.ProtocolAuto,
26 },
27 }); err != nil {
28 return // network error expected in example environment
29 }
30
31 // Output:
32}

Callers

nothing calls this directly

Calls 1

SyncMethod · 0.45

Tested by

no test coverage detected