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

Function TestClientCheckoutNewBranchReportsMissingTrackingBranch

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

Source from the content-addressed store, hash-verified

1046}
1047
1048func TestClientCheckoutNewBranchReportsMissingTrackingBranch(t *testing.T) {
1049 // Given a repository without the requested remote tracking branch
1050 repo := newTestRepo(t)
1051
1052 // When a local branch is created from it
1053 err := repo.client.CheckoutNewBranch(t.Context(), "origin", "missing")
1054
1055 // Then Git's checkout error is returned and no branch is created
1056 require.Error(t, err)
1057 var gitError *GitError
1058 require.ErrorAs(t, err, &gitError)
1059 assert.NotZero(t, gitError.ExitCode)
1060 assert.False(t, repo.client.HasLocalBranch(t.Context(), "missing"), "failed checkout should not create a branch")
1061}
1062
1063func TestClientToplevelDirReturnsRepositoryRootFromSubdirectory(t *testing.T) {
1064 // Given a client operating from a nested repository directory

Callers

nothing calls this directly

Calls 4

newTestRepoFunction · 0.85
CheckoutNewBranchMethod · 0.80
HasLocalBranchMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected