From 50a0c2ef461c2623f960decc4fa8268d639ef983 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 19 Jun 2022 22:13:20 +0200 Subject: [PATCH] fix(cli): ci.el loader - :before ci will try to load $REPOROOT/ci.el or $DOOMDIR/ci.el. It finds $REPOROOT by calling `git`, but doesn't handle errors. Now it does. - Because &rest was in :before ci's argspec, :before ci * subcommands would be inaccessible (not that any exist atm, though). - Let the user know when it finds the project's ci.el. --- core/cli/ci.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/cli/ci.el b/core/cli/ci.el index 571cb28d4..0a1dd6a30 100644 --- a/core/cli/ci.el +++ b/core/cli/ci.el @@ -247,15 +247,18 @@ Note: warnings are not considered failures.") ;;; Commands ;;; doom ci -(defcli! (:before ci) (&rest _) +(defcli! (:before ci) (&args _) (when-let* - ((repo-root (or (cdr (doom-call-process "git" "rev-parse" "--show-toplevel")) - default-directory)) + ((repo-root + (if-let* ((result (sh! "git" "rev-parse" "--show-toplevel")) + ((zerop (car result)))) + (cdr result) + default-directory)) (local-config (car (or (doom-glob repo-root "ci.el") (doom-glob doom-private-dir "ci.el"))))) - (print! (item "Loading %s") (path local-config)) - (load local-config nil t t))) + (load local-config nil t t) + (print! (item "Loaded %S") local-config))) (defcli! ci () "Commands that automate development processes."