doomemacs/lisp/lib/git.el
Henrik Lissner 6c0881c684
nit: revise TODO/FIXME/HACK/REVIEW/etc in comments
Some were outdated, some were incorrectly labeled, others were already
completed, some were missing... Gotta fix them all.

Also, in :ui hl-todo, there are comments that describe how Doom uses
each of these annotations; those have been updated.
2026-03-02 19:45:09 -05:00

16 lines
505 B
EmacsLisp

;;; lisp/lib/git.el -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
;;;###autoload
(defun doom-git-toplevel (&rest segments)
"Return the path to the current repo's root."
(cl-destructuring-bind (code . output)
(doom-call-process "git" "rev-parse" "--show-toplevel")
(if (zerop code)
(apply #'file-name-concat output segments)
;; TODO: throw stderr as error
(user-error "Not in a git repo: %s" default-directory))))
(provide 'doom-lib '(git))
;;; git.el ends here