From 7958caa410de296ba8ebcbe479752fd22b6ae746 Mon Sep 17 00:00:00 2001 From: TEC Date: Fri, 12 Jan 2024 15:36:42 +0800 Subject: [PATCH] Improve draft publishing behaviour --- publish.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/publish.el b/publish.el index 4b75252..96e5a5f 100755 --- a/publish.el +++ b/publish.el @@ -19,8 +19,8 @@ Switches: -f, --force Force publishing all files - -d, --draft Publish a draft update, including DRAFT-* files - -p, --publish Explicitly publish an update (default), negates --draft + -d, --draft Explicitly publish a draft update (force re-publishes all DRAFT-* files) + -p, --publish Explicitly publish an update (ignores all DRAFT-* files) -n, --nopush Skip the push step, perform a dry-run -o, --onlypush Skip file generation, just push (intended for use after a dry-run) @@ -550,6 +550,12 @@ Should an error occur, an informative message is printed." (git-try-command "commit" "--message" commit-message) (git-try-command "push" (and html-draft-p "--force-with-lease"))))))) +(when cli-mode-draft + (dolist (file (mapcar #'cdr (get-unstaged-changes))) + (when (and (file-exists-p file) + (string-prefix-p "DRAFT-" (file-name-base file))) + (set-file-times file)))) + (cond (cli-mode-nopush (do-publish)