Support a local repo as URL in 'treesit-language-source-alist'
authorKonstantin Kharlamov <Hi-Angel@yandex.ru>
Fri, 19 Jan 2024 07:33:47 +0000 (10:33 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 27 Jan 2024 19:18:27 +0000 (21:18 +0200)
commit54c6588952b469df8d7983b6735461f542cd806e
tree0bdc37e803849cf617b96f1e8ca08262e6e4003f
parent12afe75cf7af99eabf821e40dd2fab2f9c3efcf9
Support a local repo as URL in 'treesit-language-source-alist'

Sometimes people may need to bisect to find specific revision
in a grammar library's repo.  In this case they'd want to point
the URL to the local repo to avoid cloning it on every rebuild.
So add support for a directory instead of URL in
'treesit-language-source-alist'.
* lisp/treesit.el (treesit--install-language-grammar-1): Test
if URL is a local directory.  Then if it is, avoid cloning the
repo and removing the path on success.
(treesit--git-clone-repo): Factor out the code for cloning to
a separate function.
(treesit--git-checkout-branch): A helper to checkout the
revision for cases where we didn't clone the repo but want it
to point the revision.  (Bug#68579)
etc/NEWS
lisp/treesit.el