MCPcopy Index your code
hub / github.com/nikivdev/go / fetchMirrorBranch

Function fetchMirrorBranch

cli/flow/main.go:4299–4314  ·  view source on GitHub ↗
(ctx *snap.Context, remote, branch string)

Source from the content-addressed store, hash-verified

4297}
4298
4299func fetchMirrorBranch(ctx *snap.Context, remote, branch string) (string, error) {
4300 if err := runGitCommandStreaming(ctx, "fetch", remote, "--prune"); err != nil {
4301 return "", fmt.Errorf("git fetch %s --prune: %w", remote, err)
4302 }
4303
4304 remoteRefName := fmt.Sprintf("refs/remotes/%s/%s", remote, branch)
4305 exists, err := gitRefExists(remoteRefName)
4306 if err != nil {
4307 return "", fmt.Errorf("check remote branch %s: %w", remoteRefName, err)
4308 }
4309 if !exists {
4310 return "", fmt.Errorf("remote branch %s/%s not found", remote, branch)
4311 }
4312
4313 return fmt.Sprintf("%s/%s", remote, branch), nil
4314}
4315
4316func getGitLocalConfig(key string) (string, error) {
4317 cmd := exec.Command("git", "config", "--local", "--get", key)

Callers 2

runGitMirrorPullFunction · 0.85
runGitMirrorTakeFunction · 0.85

Calls 2

runGitCommandStreamingFunction · 0.85
gitRefExistsFunction · 0.85

Tested by

no test coverage detected