Skip to content

Commit a00c478

Browse files
committed
Fix gitignore check
1 parent 5ca3bf0 commit a00c478

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

Pro

Submodule Pro updated from 33771b2 to 3800388

Tool/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/ActiveDocumentChatContextCollector.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ public final class ActiveDocumentChatContextCollector: ChatContextCollector {
130130
let codeRange = "Focused Range [line, character]: \(focusedContext.codeRange)"
131131

132132
let code = context.selectionRange.isEmpty && isSensitive
133-
? ""
133+
? """
134+
The file is in gitignore, you can't read the file.
135+
Ask the user to select the code in the editor to get help. Also tell them the file is in gitignore.
136+
"""
134137
: """
135138
Focused Code (start from line \(focusedContext.codeRange.start.line + 1)):
136139
```\(context.language.rawValue)

Tool/Sources/GitIgnoreCheck/GitIgnoreCheck.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public struct DefaultGitIgnoredChecker: GitIgnoredChecker {
5454
do {
5555
_ = try await terminal.runCommand(
5656
"/bin/bash",
57-
arguments: ["-c", "check-ignore \"\(fileURL.path)\""],
57+
arguments: ["-i", "-c", "git check-ignore \"\(fileURL.path)\""],
5858
currentDirectoryPath: gitFolderURL.path,
5959
environment: [:]
6060
)
@@ -75,7 +75,7 @@ public struct DefaultGitIgnoredChecker: GitIgnoredChecker {
7575
do {
7676
let result = try await terminal.runCommand(
7777
"/bin/bash",
78-
arguments: ["-c", "check-ignore \(filePaths)"],
78+
arguments: ["-i", "-c", "git check-ignore \(filePaths)"],
7979
currentDirectoryPath: gitFolderURL.path,
8080
environment: [:]
8181
)

Tool/Sources/WorkspaceSuggestionService/Workspace+SuggestionService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public extension Workspace {
3535

3636
let filespace = createFilespaceIfNeeded(fileURL: fileURL)
3737

38-
guard await filespace.isGitIgnored else { return [] }
38+
guard !(await filespace.isGitIgnored) else { throw SuggestionFeatureDisabledError() }
3939

4040
if !editor.uti.isEmpty {
4141
filespace.codeMetadata.uti = editor.uti

0 commit comments

Comments
 (0)