From 7690dc82f2fd36b0b9ef999ee2be3133e6f917b3 Mon Sep 17 00:00:00 2001 From: TEC Date: Thu, 11 Jan 2024 16:13:21 +0800 Subject: [PATCH] Rework reset/draft publish logic --- publish.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/publish.el b/publish.el index 35c5cb3..4140c9e 100755 --- a/publish.el +++ b/publish.el @@ -491,13 +491,13 @@ PROJECT is the current project." (if (= html-changed-files 0) (warn! "No changes to push") (let ((default-directory html-dir)) - (and (or source-draft-p - (prog1 (or (not html-draft-p) - (git-try-command "reset" "--soft" "HEAD~1")) - (dolist (file (mapcar #'cdr (get-unstaged-changes))) - (when (and (file-exists-p file) - (string-prefix-p "DRAFT-" (file-name-base file))) - (delete-file file))))) + (and (prog1 (or (not html-draft-p) + (git-try-command "reset" "--soft" "HEAD~1")) + (unless source-draft-p + (dolist (file (mapcar #'cdr (get-unstaged-changes))) + (when (and (file-exists-p file) + (string-prefix-p "DRAFT-" (file-name-base file))) + (delete-file file))))) (git-try-command "add" "-A") (git-try-command "commit" "--message" commit-message) (git-try-command "push" (and html-draft-p "--force-with-lease"))))))