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.
This commit is contained in:
Yuan Fu 2024-12-23 17:12:39 -08:00
parent 8d7cba7bbf
commit 93755ea1a6
No known key found for this signature in database
GPG key ID: 56E19BC57664A442
2 changed files with 6 additions and 0 deletions

View file

@ -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)

View file

@ -3925,6 +3925,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.
@ -4048,6 +4051,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)))