NewTestRepo creates and initializes a test repository in a temporary directory constructed using `pattern`. The caller must delete the repository by calling `repo.Remove()`.
(t *testing.T, bare bool, pattern string)
| 27 | // temporary directory constructed using `pattern`. The caller must |
| 28 | // delete the repository by calling `repo.Remove()`. |
| 29 | func NewTestRepo(t *testing.T, bare bool, pattern string) *TestRepo { |
| 30 | t.Helper() |
| 31 | |
| 32 | path, err := ioutil.TempDir("", pattern) |
| 33 | require.NoError(t, err) |
| 34 | |
| 35 | repo := TestRepo{Path: path} |
| 36 | |
| 37 | repo.Init(t, bare) |
| 38 | |
| 39 | return &TestRepo{ |
| 40 | Path: path, |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // Init initializes a git repository at `repo.Path`. |
| 45 | func (repo *TestRepo) Init(t *testing.T, bare bool) { |