From e31753bf0967050222349649aa32f8bb68797c76 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 23 Dec 2024 17:12:39 -0800 Subject: [PATCH] Create a blobless clone in treesit-admin--verify-major-mode-queries * admin/treesit-admin.el (treesit-admin--verify-major-mode-queries): Create a blobless clone. * lisp/treesit.el (treesit--install-language-grammar-blobless): New variable. (treesit--git-clone-repo): Support blobless clone. (cherry picked from commit 93755ea1a6113e115ac3349b67e58e2f3fd03894) --- admin/treesit-admin.el | 1 + lisp/treesit.el | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/admin/treesit-admin.el b/admin/treesit-admin.el index 3c0798a29f2..440056aff21 100644 --- a/admin/treesit-admin.el +++ b/admin/treesit-admin.el @@ -96,6 +96,7 @@ queries that has problems with latest grammar." (let ((treesit-extra-load-path (list grammar-dir)) (treesit-language-source-alist treesit-admin--builtin-language-sources) (treesit--install-language-grammar-full-clone t) + (treesit--install-language-grammar-blobless t) (version-alist nil) (invalid-feature-list nil) (valid-modes nil) diff --git a/lisp/treesit.el b/lisp/treesit.el index 1b49c3cb8bf..0a4de2d2364 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3917,6 +3917,9 @@ See `treesit-language-source-alist' for details." (defvar treesit--install-language-grammar-full-clone nil "If non-nil, do a full clone when cloning git repos.") +(defvar treesit--install-language-grammar-blobless nil + "If non-nil, create a blobless clone when cloning git repos.") + ;;;###autoload (defun treesit-install-language-grammar (lang &optional out-dir) "Build and install the tree-sitter language grammar library for LANG. @@ -4039,6 +4042,8 @@ Use shallow clone by default. Do a full clone when (let ((args (list "git" nil t nil "clone" url "--quiet"))) (when (not treesit--install-language-grammar-full-clone) (setq args (append args (list "--depth" "1")))) + (when treesit--install-language-grammar-blobless + (setq args (append args (list "--filter=blob:none")))) (when revision (setq args (append args (list "-b" revision)))) (setq args (append args (list workdir))) -- 2.39.5