From c1405db6560273ce4eaf0d5c1b13932b876b72a0 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Fri, 3 Jan 2025 12:02:50 +0000 Subject: [PATCH 1/2] New function treesit--language-git-version-tags * lisp/treesit.el (treesit--language-git-version-tags): New function to list version tags for a Tree-sitter parser Git repository. --- lisp/treesit.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisp/treesit.el b/lisp/treesit.el index f3c553fdb8f..a89fa2ae13e 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -4262,6 +4262,18 @@ treesit--language-git-revision (string-trim (buffer-string))) (t nil)))) +(defun treesit--language-git-version-tags (repo-dir) + "Return a list of Git version tags in REPO-DIR, sorted latest first. + +Return the output of \"git tag --list --sort=-version:refname 'v*'\". If +anything goes wrong, return nil." + (with-temp-buffer + (cond + ((eq 0 (call-process "git" nil t nil "-C" repo-dir "tag" + "--list" "--sort=-version:refname" "v*")) + (split-string (buffer-string))) + (t nil)))) + (defun treesit--language-git-timestamp (repo-dir) "Return the commit date in REPO-DIR in UNIX epoch. -- 2.47.1