@file don't respect config respectGitIgnore=false (#3382) (#3387)

Co-authored-by: Ryan Fang <ryan.fang@gllue.com>
This commit is contained in:
zfflxx
2025-07-07 13:48:39 +08:00
committed by GitHub
parent f2d0ea8324
commit c60a5d603c
5 changed files with 109 additions and 33 deletions
@@ -41,7 +41,10 @@ describe('useCompletion git-aware filtering integration', () => {
beforeEach(() => {
mockFileDiscoveryService = {
shouldGitIgnoreFile: vi.fn(),
shouldGeminiIgnoreFile: vi.fn(),
shouldIgnoreFile: vi.fn(),
filterFiles: vi.fn(),
getGeminiIgnorePatterns: vi.fn(() => []),
};
mockConfig = {
@@ -68,6 +71,14 @@ describe('useCompletion git-aware filtering integration', () => {
mockFileDiscoveryService.shouldGitIgnoreFile.mockImplementation(
(path: string) => path.includes('dist'),
);
mockFileDiscoveryService.shouldIgnoreFile.mockImplementation(
(path: string, options) => {
if (options?.respectGitIgnore !== false) {
return mockFileDiscoveryService.shouldGitIgnoreFile(path);
}
return false;
},
);
const { result } = renderHook(() =>
useCompletion('@d', testCwd, true, slashCommands, mockConfig),
@@ -102,6 +113,14 @@ describe('useCompletion git-aware filtering integration', () => {
path.includes('dist') ||
path.includes('.env'),
);
mockFileDiscoveryService.shouldIgnoreFile.mockImplementation(
(path: string, options) => {
if (options?.respectGitIgnore !== false) {
return mockFileDiscoveryService.shouldGitIgnoreFile(path);
}
return false;
},
);
const { result } = renderHook(() =>
useCompletion('@', testCwd, true, slashCommands, mockConfig),
@@ -153,6 +172,14 @@ describe('useCompletion git-aware filtering integration', () => {
mockFileDiscoveryService.shouldGitIgnoreFile.mockImplementation(
(path: string) => path.includes('node_modules') || path.includes('temp'),
);
mockFileDiscoveryService.shouldIgnoreFile.mockImplementation(
(path: string, options) => {
if (options?.respectGitIgnore !== false) {
return mockFileDiscoveryService.shouldGitIgnoreFile(path);
}
return false;
},
);
const { result } = renderHook(() =>
useCompletion('@t', testCwd, true, slashCommands, mockConfig),
@@ -261,6 +288,14 @@ describe('useCompletion git-aware filtering integration', () => {
mockFileDiscoveryService.shouldGitIgnoreFile.mockImplementation(
(path: string) => path.includes('.log'),
);
mockFileDiscoveryService.shouldIgnoreFile.mockImplementation(
(path: string, options) => {
if (options?.respectGitIgnore !== false) {
return mockFileDiscoveryService.shouldGitIgnoreFile(path);
}
return false;
},
);
const { result } = renderHook(() =>
useCompletion('@src/comp', testCwd, true, slashCommands, mockConfig),