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

Function TestClientAddRemoteTracksAllBranches

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

Source from the content-addressed store, hash-verified

1517}
1518
1519func TestClientAddRemoteTracksAllBranches(t *testing.T) {
1520 // Given a repository and a local bare remote
1521 repo := newTestRepo(t)
1522 remoteURL := newBareTestRepo(t).fileURL()
1523
1524 // When the remote is added without branch restrictions
1525 remote, err := repo.client.AddRemote(t.Context(), "test", remoteURL, nil)
1526
1527 // Then Git stores the remote and its all-branches fetch refspec
1528 require.NoError(t, err)
1529 assert.Equal(t, "test", remote.Name)
1530 assert.Equal(t, remoteURL, remote.FetchURL.String())
1531 assert.Equal(t, remoteURL, repo.run(t, "remote", "get-url", "test"))
1532 assert.Equal(t, "+refs/heads/*:refs/remotes/test/*", repo.run(t, "config", "--get-all", "remote.test.fetch"))
1533}
1534
1535func TestClientAddRemoteTracksSpecificBranches(t *testing.T) {
1536 // Given a repository and a local bare remote

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected