Skip to content

Commit c37877d

Browse files
committed
gptel-context: Never exclude git-ignored remote files
1 parent 10356a8 commit c37877d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.org

+1-1
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ You can examine the active context from the menu:
10051005
And then browse through or remove context from the context buffer:
10061006
#+html: <img src="https://github.com/karthink/gptel/assets/8607532/79a5ffe8-3d63-4bf7-9bf6-0457ab61bf2a" align="center" alt="Image showing gptel's context buffer.">
10071007

1008-
By default, files in a repository’s =.gitignore= file are excluded from the context. To include these files, set =gptel-context-exclude-git-ignored= to =nil=.
1008+
By default, files in a local repository’s =.gitignore= file are excluded from the context. To include these files, set =gptel-context-exclude-git-ignored= to =nil=. Note that remote files are always included, regardless of the value of ==gptel-context-exclude-git-ignored==.
10091009

10101010
*** Handle "reasoning" content
10111011

gptel-context.el

+3
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ files list."
261261
(cond ((file-directory-p path)
262262
(gptel-context--add-directory path 'add git-cache))
263263
((and gptel-context-exclude-git-ignored
264+
(not (file-remote-p path))
264265
(if git-cache
265266
;; Use cached git info if available
266267
(let ((git-root (car git-cache))
@@ -285,6 +286,7 @@ files list."
285286
Return a cons cell `(git-root . tracked-files)' or nil if not
286287
applicable."
287288
(when (and gptel-context-exclude-git-ignored
289+
(not (file-remote-p directory))
288290
(executable-find "git"))
289291
(when-let ((git-root (locate-dominating-file directory ".git")))
290292
(cons git-root (gptel-context--get-git-unignored git-root)))))
@@ -303,6 +305,7 @@ Fall back to nil (allowing all files) if Git command fails."
303305
(defun gptel-context--git-skip-p (file)
304306
"Return non-nil if FILE should be skipped due to gitignore rules."
305307
(when (and gptel-context-exclude-git-ignored
308+
(not (file-remote-p file))
306309
(executable-find "git"))
307310
(when-let* ((git-root (locate-dominating-file file ".git"))
308311
(rel-path (file-relative-name file git-root)))

0 commit comments

Comments
 (0)