Clone creates a clone of `repo` at a temporary path constructued using `pattern`. The caller is responsible for removing it when done by calling `Remove()`.
(t *testing.T, pattern string)
| 71 | // using `pattern`. The caller is responsible for removing it when |
| 72 | // done by calling `Remove()`. |
| 73 | func (repo *TestRepo) Clone(t *testing.T, pattern string) *TestRepo { |
| 74 | t.Helper() |
| 75 | |
| 76 | path, err := ioutil.TempDir("", pattern) |
| 77 | require.NoError(t, err) |
| 78 | |
| 79 | err = repo.GitCommand( |
| 80 | t, "clone", "--bare", "--mirror", repo.Path, path, |
| 81 | ).Run() |
| 82 | require.NoError(t, err) |
| 83 | |
| 84 | return &TestRepo{ |
| 85 | Path: path, |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | // Repository returns a `*git.Repository` for `repo`. |
| 90 | func (repo *TestRepo) Repository(t *testing.T) *git.Repository { |