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

Function TestClientIsIgnoredSeparatesPathFromOptions

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

Source from the content-addressed store, hash-verified

1834}
1835
1836func TestClientIsIgnoredSeparatesPathFromOptions(t *testing.T) {
1837 // Given an ignored path that resembles a Git option
1838 repo := newTestRepo(t)
1839 require.NoError(t, os.WriteFile(filepath.Join(repo.dir, ".gitignore"), []byte("--no-index\n"), 0600))
1840 require.NoError(t, os.WriteFile(filepath.Join(repo.dir, "--no-index"), nil, 0600))
1841
1842 // When the path is checked
1843 ignored, err := repo.client.IsIgnored(t.Context(), "--no-index")
1844
1845 // Then an option separator protects the path
1846 require.NoError(t, err)
1847 assert.True(t, ignored, "expected option-like path to match its ignore rule")
1848}
1849
1850func TestClientIsIgnoredReportsMissingGitExecutable(t *testing.T) {
1851 // Given Git cannot be resolved

Callers

nothing calls this directly

Calls 4

newTestRepoFunction · 0.85
WriteFileMethod · 0.80
JoinMethod · 0.80
IsIgnoredMethod · 0.80

Tested by

no test coverage detected