From 7e0c093bcfa84cf5928f6112fe77f8fb0e0791a2 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Dec 2019 14:53:52 -0500 Subject: [PATCH] cli/upgrade: fix dirty worktree detection --- core/cli/upgrade.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/cli/upgrade.el b/core/cli/upgrade.el index cfdf2d6ee..54ccb660b 100644 --- a/core/cli/upgrade.el +++ b/core/cli/upgrade.el @@ -36,7 +36,7 @@ following shell commands: (cl-destructuring-bind (success . stdout) (doom-call-process "git" "status" "--porcelain" "-uno") (if (= 0 success) - (string-match-p "[^ \t\n]" (buffer-string)) + (split-string stdout "\n" t) (error "Failed to check working tree in %s" dir)))) @@ -55,11 +55,12 @@ following shell commands: "Couldn't detect what branch you're on. Is Doom detached?"))) ;; We assume that a dirty .emacs.d is intentional and abort - (when (doom--working-tree-dirty-p default-directory) + (when-let (dirty (doom--working-tree-dirty-p default-directory)) (if (not force-p) - (user-error! "%s\n\n%s" + (user-error! "%s\n\n%s\n\n %s" (format "Refusing to upgrade because %S has been modified." (path doom-emacs-dir)) - "Either stash/undo your changes or run 'doom upgrade -f' to discard local changes.") + "Either stash/undo your changes or run 'doom upgrade -f' to discard local changes." + (string-join dirty "\n")) (print! (info "You have local modifications in Doom's source. Discarding them...")) (doom-call-process "git" "reset" "--hard" (format "origin/%s" branch)) (doom-call-process "git" "clean" "-ffd")))