(ctx *snap.Context, remote, branch string)
| 4297 | } |
| 4298 | |
| 4299 | func 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 | |
| 4316 | func getGitLocalConfig(key string) (string, error) { |
| 4317 | cmd := exec.Command("git", "config", "--local", "--get", key) |
no test coverage detected