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

Function TestClientGitDirReportsNonRepository

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

Source from the content-addressed store, hash-verified

1104}
1105
1106func TestClientGitDirReportsNonRepository(t *testing.T) {
1107 // Given a client outside a Git repository
1108 IsolateConfig(t)
1109 client := Client{RepoDir: t.TempDir()}
1110
1111 // When the Git metadata directory is requested
1112 dir, err := client.GitDir(t.Context())
1113
1114 // Then Git's repository error is returned
1115 require.Error(t, err)
1116 var gitError *GitError
1117 require.ErrorAs(t, err, &gitError)
1118 assert.Equal(t, 128, gitError.ExitCode)
1119 assert.Empty(t, dir)
1120}
1121
1122func TestClientPathFromRootReturnsNestedPath(t *testing.T) {
1123 // Given a client operating from a nested repository directory

Callers

nothing calls this directly

Calls 5

GitDirMethod · 0.95
IsolateConfigFunction · 0.85
EqualMethod · 0.80
EmptyMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected