fix(cli): deploy git hooks to repo at $PWD, not $EMACSDIR

This commit is contained in:
Henrik Lissner 2022-06-19 23:03:50 +02:00
parent d002e4c89d
commit b81e4af66a
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -266,11 +266,14 @@ Note: warnings are not considered failures.")
(defcli! (ci deploy-hooks) ((force ("--force"))) (defcli! (ci deploy-hooks) ((force ("--force")))
"TODO" "TODO"
(let* ((default-directory doom-emacs-dir) (let* ((repo-path (sh! "git" "rev-parse" "--show-toplevel"))
(repo-path (cdr (doom-call-process "git" "rev-parse" "--show-toplevel"))) (repo-path (if (zerop (car repo-path))
(submodule-p (string-empty-p (cdr (doom-call-process "git" "rev-parse" "show-superproject-working-tree")))) (cdr repo-path)
(config-hooks-path (cdr (doom-call-process "git" "config" "core.hooksPath"))) (user-error "Cannot locate a git repo in %s"
(hooks-path (cdr (doom-call-process "git" "rev-parse" "--git-path" "hooks")))) (file-relative-name default-directory))))
(submodule-p (string-empty-p (cdr (sh! "git" "rev-parse" "show-superproject-working-tree"))))
(config-hooks-path (cdr (sh! "git" "config" "core.hooksPath")))
(hooks-path (cdr (sh! "git" "rev-parse" "--git-path" "hooks"))))
(unless (string-empty-p config-hooks-path) (unless (string-empty-p config-hooks-path)
(or force (or force
(y-or-n-p (y-or-n-p