MCPcopy
hub / github.com/cli/cli / syncFork

Function syncFork

pkg/cmd/repo/sync/http.go:68–80  ·  view source on GitHub ↗
(client *api.Client, repo ghrepo.Interface, branch, SHA string, force bool)

Source from the content-addressed store, hash-verified

66}
67
68func syncFork(client *api.Client, repo ghrepo.Interface, branch, SHA string, force bool) error {
69 path := fmt.Sprintf("repos/%s/%s/git/refs/heads/%s", repo.RepoOwner(), repo.RepoName(), branch)
70 body := map[string]interface{}{
71 "sha": SHA,
72 "force": force,
73 }
74 requestByte, err := json.Marshal(body)
75 if err != nil {
76 return err
77 }
78 requestBody := bytes.NewReader(requestByte)
79 return client.REST(repo.RepoHost(), "PATCH", path, requestBody, nil)
80}

Callers 1

executeRemoteRepoSyncFunction · 0.85

Calls 4

RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RESTMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected