setupRemoteAndClone creates a remote repository with a single commit on `main` and clones it into a separate local directory. It returns the remote and local paths.
(t *testing.T)
| 376 | // setupRemoteAndClone creates a remote repository with a single commit on `main` |
| 377 | // and clones it into a separate local directory. It returns the remote and local paths. |
| 378 | func setupRemoteAndClone(t *testing.T) (string, string) { |
| 379 | remote := setupTestRepository(t) |
| 380 | local := t.TempDir() |
| 381 | // t.TempDir() pre-creates the directory; remove it so `git clone` can populate it. |
| 382 | require.NoError(t, os.RemoveAll(local)) |
| 383 | |
| 384 | err := Clone(context.Background(), local, remote, "main", false, false) |
| 385 | require.NoError(t, err) |
| 386 | setupGitConfig(t, local) |
| 387 | return remote, local |
| 388 | } |
| 389 | |
| 390 | func execGit(repoPath string, args ...string) error { |
| 391 | cmd := exec.Command("git", append([]string{"-C", repoPath}, args...)...) |
no test coverage detected