The value should be an alist where each element has the form
- (LANG . (URL REVISION SOURCE-DIR CC C++))
+ (LANG . (URL REVISION SOURCE-DIR CC C++ COMMIT))
Only LANG and URL are mandatory. LANG is the language symbol.
URL is the URL of the grammar's Git repository or a directory
where the repository has been cloned.
-REVISION is the Git tag or branch of the desired version,
-defaulting to the latest default branch.
+REVISION is the Git tag or branch of the desired version, defaulting to
+the latest default branch. If COMMIT is non-nil, checkout this commit
+hash after cloning the repo. COMMIT has precedence over REVISION if
+both are non-nil.
SOURCE-DIR is the relative subdirectory in the repository in which
the grammar's parser.c file resides, defaulting to \"src\".
default branch.
Use shallow clone by default. Do a full clone when
-`treesit--install-language-grammar-full-clone' is t."
+`treesit--install-language-grammar-full-clone' is t. Do a blobless
+clone if `treesit--install-language-grammar-blobless' is t."
(message "Cloning repository")
;; git clone xxx --depth 1 --quiet [-b yyy] workdir
(let ((args (list "git" nil t nil "clone" url "--quiet")))
(apply #'treesit--call-process-signal args)))
(defun treesit--install-language-grammar-1
- (out-dir lang url &optional revision source-dir cc c++)
+ (out-dir lang url &optional revision source-dir cc c++ commit)
"Install and compile a tree-sitter language grammar library.
OUT-DIR is the directory to put the compiled library file. If it
configuration directory is used (and automatically created if it
does not exist).
-For LANG, URL, REVISION, SOURCE-DIR, GRAMMAR-DIR, CC, C++, see
-`treesit-language-source-alist'. If anything goes wrong, this
-function signals an error.
+For LANG, URL, REVISION, SOURCE-DIR, GRAMMAR-DIR, CC, C++, COMMIT, see
+`treesit-language-source-alist'. If anything goes wrong, this function
+signals an error.
Return the git revision of the installed grammar. The revision is
generated by \"git describe\". It only works when
(when revision
(treesit--git-checkout-branch workdir revision))
(treesit--git-clone-repo url revision workdir))
+ (when commit
+ (treesit--git-checkout-branch workdir commit))
;; We need to go into the source directory because some
;; header files use relative path (#include "../xxx").
;; cd "${sourcedir}"