From e72c013afbafad3faf19f98acb8d0387fdf045ba Mon Sep 17 00:00:00 2001 From: Sean Allred Date: Tue, 17 Sep 2024 10:07:41 -0500 Subject: [PATCH] project--vc-list-files: use Git's sparse-index When dealing with exceptionally large Git repositories, the performance of `project-find-file` can suffer dramatically as the list of files is collected for completion. This adds insult to injury when you consider cases where the developer has configured the repository to use a sparse checkout where the vast majority of these files are not even present on disk and are not valid candidates for completion. Unconditionally pass along the `--sparse` option to `git-ls-files` to coerce `project--vc-list-files` only consider files present in the sparse index (and presumably on disk). No consideration is made to make this configurable as it is currently unclear as to the best way to do this -- whether to follow the example of the `include-untracked` symbol in this function or to adopt some other mechanism. --- lisp/progmodes/project.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index b29d5ed5404..82cb79322dd 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -663,7 +663,7 @@ project--vc-list-files (pcase backend (`Git (let* ((default-directory (expand-file-name (file-name-as-directory dir))) - (args '("-z")) + (args '("-z", "--sparse")) (vc-git-use-literal-pathspecs nil) (include-untracked (project--value-in-dir 'project-vc-include-untracked base-commit: 7d365a2d72d8e656262205827cc5fdf423c3a41f -- 2.46.0