Function: treesit--language-git-revision

treesit--language-git-revision is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit--language-git-revision REPO-DIR)

Documentation

Return the Git revision of the repo in REPO-DIR.

Return the output of "git describe". If anything goes wrong, return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit--language-git-revision (repo-dir)
  "Return the Git revision of the repo in REPO-DIR.

Return the output of \"git describe\". If anything goes wrong, return
nil."
  (with-temp-buffer
    (cond
     ((eq 0 (call-process "git" nil t nil "-C" repo-dir "describe" "--tags"))
      (string-trim (buffer-string)))
     ((eq 0 (progn (erase-buffer)
                   (call-process "git" nil t nil
                                 "-C" repo-dir "rev-parse" "HEAD")))
      (string-trim (buffer-string)))
     (t nil))))