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

Function TestClientSetRemoteBranchesLimitsTrackedBranches

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

Source from the content-addressed store, hash-verified

1177}
1178
1179func TestClientSetRemoteBranchesLimitsTrackedBranches(t *testing.T) {
1180 // Given a repository that fetches every branch from a local remote
1181 repo := newTestRepo(t)
1182 repo.run(t, "remote", "add", "origin", newBareTestRepo(t).fileURL())
1183
1184 // When the tracked remote branches are limited to trunk
1185 err := repo.client.SetRemoteBranches(t.Context(), "origin", "trunk")
1186
1187 // Then only the trunk remote-tracking ref is configured
1188 require.NoError(t, err)
1189 assert.Equal(t, "+refs/heads/trunk:refs/remotes/origin/trunk", repo.run(t, "config", "--get-all", "remote.origin.fetch"))
1190}
1191
1192func TestClientSetRemoteBranchesReportsMissingRemote(t *testing.T) {
1193 // Given a repository without the named remote

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected