MCPcopy Index your code
hub / github.com/rilldata/rill / FetchBranches

Function FetchBranches

runtime/pkg/gitutil/gitcmdwrapper.go:172–184  ·  view source on GitHub ↗

FetchBranches fetches the specified branches from the remote repository. If a branch doesn't exist on the remote, it will be skipped without returning an error.

(ctx context.Context, path string, branches ...string)

Source from the content-addressed store, hash-verified

170// FetchBranches fetches the specified branches from the remote repository.
171// If a branch doesn't exist on the remote, it will be skipped without returning an error.
172func FetchBranches(ctx context.Context, path string, branches ...string) error {
173 for _, branch := range branches {
174 // fetch separately to avoid NoMatchingRefSpecError when one of the branches doesn't exist on remote
175 _, err := Run(ctx, path, "fetch", "origin", branch)
176 if err != nil {
177 if strings.Contains(err.Error(), "find remote ref") {
178 continue
179 }
180 return err
181 }
182 }
183 return nil
184}
185
186// IsCommitHash reports whether s is a full hex commit hash (SHA-1 or SHA-256).
187// Use it to validate untrusted hashes before passing them as git CLI arguments: it rules out

Callers 5

pullInnerMethod · 0.92
mergeToBranchMethod · 0.92
fetchCurrentBranchMethod · 0.92
StatusMethod · 0.92
TestFetchBranchesFunction · 0.85

Calls 3

ContainsMethod · 0.80
RunFunction · 0.70
ErrorMethod · 0.45

Tested by 1

TestFetchBranchesFunction · 0.68