(t *testing.T)
| 1389 | } |
| 1390 | |
| 1391 | func TestClientCloneCreatesBareRepository(t *testing.T) { |
| 1392 | // Given a populated local remote and an empty destination parent |
| 1393 | source := newTestRepo(t) |
| 1394 | remote := newBareTestRepo(t) |
| 1395 | wantHead := source.commit(t, "remote commit") |
| 1396 | source.run(t, "remote", "add", "origin", remote.fileURL()) |
| 1397 | source.run(t, "push", "--quiet", "origin", "trunk") |
| 1398 | parentDir := t.TempDir() |
| 1399 | client := &Client{} |
| 1400 | |
| 1401 | // When the remote is cloned as bare |
| 1402 | target, err := client.Clone(t.Context(), remote.fileURL(), []string{"--bare"}, WithRepoDir(parentDir)) |
| 1403 | |
| 1404 | // Then the target keeps its .git suffix and contains the trunk ref |
| 1405 | require.NoError(t, err) |
| 1406 | assert.Equal(t, "remote.git", target) |
| 1407 | clonedDir := filepath.Join(parentDir, target) |
| 1408 | assert.Equal(t, "true", runGitAt(t, clonedDir, "rev-parse", "--is-bare-repository")) |
| 1409 | assert.Equal(t, wantHead, runGitAt(t, clonedDir, "rev-parse", "refs/heads/trunk")) |
| 1410 | } |
| 1411 | |
| 1412 | func TestClientCloneUsesExplicitBareTarget(t *testing.T) { |
| 1413 | // Given a populated local remote and an empty destination parent |
nothing calls this directly
no test coverage detected