MCPcopy Create free account
hub / github.com/cli/cli / syncFork

Function syncFork

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

Source from the content-addressed store, hash-verified

72}
73
74func syncFork(client *api.Client, repo ghrepo.Interface, branch, SHA string, force bool) error {
75 path, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "git", "refs", fmt.Sprintf("heads/%s", branch))
76 if err != nil {
77 return err
78 }
79 body := map[string]any{
80 "sha": SHA,
81 "force": force,
82 }
83 requestByte, err := json.Marshal(body)
84 if err != nil {
85 return err
86 }
87 requestBody := bytes.NewReader(requestByte)
88 return client.REST(repo.RepoHost(), "PATCH", path.String(), requestBody, nil)
89}

Callers 1

executeRemoteRepoSyncFunction · 0.85

Calls 6

JoinPathFunction · 0.92
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RESTMethod · 0.65
RepoHostMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected