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

Function syncFork

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

Source from the content-addressed store, hash-verified

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

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