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

Function TestClientAddRemoteTracksSpecificBranches

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

Source from the content-addressed store, hash-verified

1533}
1534
1535func TestClientAddRemoteTracksSpecificBranches(t *testing.T) {
1536 // Given a repository and a local bare remote
1537 repo := newTestRepo(t)
1538 remoteURL := newBareTestRepo(t).fileURL()
1539
1540 // When the remote is added with specific tracking branches
1541 remote, err := repo.client.AddRemote(t.Context(), "test", remoteURL, []string{"trunk", "dev"})
1542
1543 // Then Git stores one fetch refspec for each requested branch
1544 require.NoError(t, err)
1545 assert.Equal(t, "test", remote.Name)
1546 assert.Equal(t, remoteURL, repo.run(t, "remote", "get-url", "test"))
1547 assert.Equal(t, "+refs/heads/trunk:refs/remotes/test/trunk\n+refs/heads/dev:refs/remotes/test/dev", repo.run(t, "config", "--get-all", "remote.test.fetch"))
1548}
1549
1550type testRepo struct {
1551 dir string

Callers

nothing calls this directly

Calls 6

newTestRepoFunction · 0.85
newBareTestRepoFunction · 0.85
fileURLMethod · 0.80
AddRemoteMethod · 0.80
EqualMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected