pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

commit 098a40cb16639267ab7002430a7e1ebbade7b709
parent ab93aa742170682196711012f3e4b85594ba77d3
Author: pyratebeard <root@pyratebeard.net>
Date:   Thu, 13 Oct 2022 16:03:52 +0100

exit if switching branches fails. exit if no changes made to draft

Diffstat:
Mscripts/draft | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/draft b/scripts/draft @@ -7,7 +7,7 @@ POST="entry/${TITLE}.md" # checkout the correct branch git branch | grep ${TITLE} && \ git checkout -q ${TITLE} || \ - $(git checkout -q main && git checkout -q -b ${TITLE}) + $(git checkout -q main && git checkout -q -b ${TITLE}) || exit 1 # if post file does not exist yet touch it [ -f "${POST}" ] || touch "${POST}" @@ -16,5 +16,7 @@ git branch | grep ${TITLE} && \ vim "${POST}" # when vim closes add and commit the changes +# if there are any +git status | grep "${POST}" || exit 0 git add "${POST}" git commit -S -m "${TITLE}"