fix: revert respectGitIgnore changes outside the indexer

Reverts changes to ListFilesTool.ts, getEnvironmentDetails.ts,
WorkspaceTracker.ts, and WorkspaceTracker.spec.ts to keep the
respectGitIgnore setting scoped to the code indexer only.
This commit is contained in:
Roo Code 2026-02-24 03:00:57 +00:00
parent f8cee2b1e4
commit 49c8526e9a
4 changed files with 5 additions and 44 deletions

View file

@ -226,35 +226,6 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
details += `<name>${modeDetails.name}</name>\n`
details += `<model>${modelId}</model>\n`
// Add browser session status - Only show when active to prevent cluttering context
const isBrowserActive = cline.browserSession.isSessionActive()
if (isBrowserActive) {
// Build viewport info for status (prefer actual viewport if available, else fallback to configured setting)
const configuredViewport = (state?.browserViewportSize as string | undefined) ?? "900x600"
let configuredWidth: number | undefined
let configuredHeight: number | undefined
if (configuredViewport.includes("x")) {
const parts = configuredViewport.split("x").map((v) => Number(v))
configuredWidth = parts[0]
configuredHeight = parts[1]
}
let actualWidth: number | undefined
let actualHeight: number | undefined
const vp = cline.browserSession.getViewportSize?.()
if (vp) {
actualWidth = vp.width
actualHeight = vp.height
}
const width = actualWidth ?? configuredWidth
const height = actualHeight ?? configuredHeight
const viewportInfo = width && height ? `\nCurrent viewport size: ${width}x${height} pixels.` : ""
details += `\n# Browser Session Status\nActive - A browser session is currently open and ready for browser_action commands${viewportInfo}\n`
}
if (includeFileDetails) {
details += `\n\n# Current Workspace Directory (${cline.cwd.toPosix()}) Files\n`
const isDesktop = arePathsEqual(cline.cwd, path.join(os.homedir(), "Desktop"))
@ -270,8 +241,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
if (maxFiles === 0) {
details += "(Workspace files context disabled. Use list_files to explore if needed.)"
} else {
const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true
const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles, respectGitIgnore)
const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles)
const { showRooIgnoredFiles = false } = state ?? {}
const result = formatResponse.formatFilesList(

View file

@ -37,10 +37,8 @@ export class ListFilesTool extends BaseTool<"list_files"> {
const absolutePath = path.resolve(task.cwd, relDirPath)
const isOutsideWorkspace = isPathOutsideWorkspace(absolutePath)
const state = await task.providerRef.deref()?.getState()
const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true
const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200, respectGitIgnore)
const { showRooIgnoredFiles = false } = state ?? {}
const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200)
const { showRooIgnoredFiles = false } = (await task.providerRef.deref()?.getState()) ?? {}
const result = formatResponse.formatFilesList(
absolutePath,

View file

@ -30,14 +30,7 @@ class WorkspaceTracker {
return
}
const tempCwd = this.cwd
let respectGitIgnore = true
try {
const state = await this.providerRef.deref()?.getState()
respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true
} catch {
// Fall back to default (respect .gitignore) if state is not available
}
const [files, _] = await listFiles(tempCwd, true, MAX_INITIAL_FILES, respectGitIgnore)
const [files, _] = await listFiles(tempCwd, true, MAX_INITIAL_FILES)
if (this.prevWorkSpacePath !== tempCwd) {
return
}

View file

@ -240,7 +240,7 @@ describe("WorkspaceTracker", () => {
vitest.runAllTimers()
// Should initialize file paths for new workspace
expect(listFiles).toHaveBeenCalledWith("/test/new-workspace", true, 1000, true)
expect(listFiles).toHaveBeenCalledWith("/test/new-workspace", true, 1000)
vitest.runAllTimers()
})