MCPcopy Create free account
hub / github.com/cli/cli / TestClientCloneUsesExplicitBareTarget

Function TestClientCloneUsesExplicitBareTarget

git/client_test.go:1412–1429  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1410}
1411
1412func TestClientCloneUsesExplicitBareTarget(t *testing.T) {
1413 // Given a populated local remote and an empty destination parent
1414 source := newTestRepo(t)
1415 remote := newBareTestRepo(t)
1416 source.commit(t, "remote commit")
1417 source.run(t, "remote", "add", "origin", remote.fileURL())
1418 source.run(t, "push", "--quiet", "origin", "trunk")
1419 parentDir := t.TempDir()
1420 client := &Client{}
1421
1422 // When the remote is cloned as bare with an explicit target
1423 target, err := client.Clone(t.Context(), remote.fileURL(), []string{"custom-target", "--bare"}, WithRepoDir(parentDir))
1424
1425 // Then the reported and created directory use the explicit target
1426 require.NoError(t, err)
1427 assert.Equal(t, "custom-target", target)
1428 assert.Equal(t, "true", runGitAt(t, filepath.Join(parentDir, target), "rev-parse", "--is-bare-repository"))
1429}
1430
1431func TestClientCloneReportsMissingRepository(t *testing.T) {
1432 // Given a local repository URL that does not exist

Callers

nothing calls this directly

Calls 10

CloneMethod · 0.95
newTestRepoFunction · 0.85
newBareTestRepoFunction · 0.85
WithRepoDirFunction · 0.85
runGitAtFunction · 0.85
commitMethod · 0.80
fileURLMethod · 0.80
EqualMethod · 0.80
JoinMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected