(t *testing.T)
| 1367 | } |
| 1368 | |
| 1369 | func TestClientCloneCreatesWorkingRepositoryInModifiedRepoDir(t *testing.T) { |
| 1370 | // Given a local remote with a trunk commit and an empty destination parent |
| 1371 | source := newTestRepo(t) |
| 1372 | remote := newBareTestRepo(t) |
| 1373 | wantHead := source.commit(t, "remote commit") |
| 1374 | source.run(t, "remote", "add", "origin", remote.fileURL()) |
| 1375 | source.run(t, "push", "--quiet", "origin", "trunk") |
| 1376 | parentDir := t.TempDir() |
| 1377 | client := &Client{} |
| 1378 | |
| 1379 | // When the remote is cloned using a repository-directory modifier |
| 1380 | target, err := client.Clone(t.Context(), remote.fileURL(), nil, WithRepoDir(parentDir)) |
| 1381 | |
| 1382 | // Then the reported target contains a working repository on trunk |
| 1383 | require.NoError(t, err) |
| 1384 | assert.Equal(t, "remote", target) |
| 1385 | clonedDir := filepath.Join(parentDir, target) |
| 1386 | assert.Equal(t, "false", runGitAt(t, clonedDir, "rev-parse", "--is-bare-repository")) |
| 1387 | assert.Equal(t, "trunk", runGitAt(t, clonedDir, "branch", "--show-current")) |
| 1388 | assert.Equal(t, wantHead, runGitAt(t, clonedDir, "rev-parse", "HEAD")) |
| 1389 | } |
| 1390 | |
| 1391 | func TestClientCloneCreatesBareRepository(t *testing.T) { |
| 1392 | // Given a populated local remote and an empty destination parent |
nothing calls this directly
no test coverage detected