From 4655227d350a72a4dee1ec6195f3e81e12015b1a Mon Sep 17 00:00:00 2001 From: "Ankur Sinha (Ankur Sinha Gmail)" Date: Mon, 2 May 2022 17:31:28 +0100 Subject: [PATCH] fix: use param expansion for default commit message --- calliope.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/calliope.sh b/calliope.sh index 4bf55f0..72bb3ed 100755 --- a/calliope.sh +++ b/calliope.sh @@ -24,6 +24,7 @@ ProjectName="" bibsrc="" encryptionId="" GPG_COMMAND="gpg2" +default_commit_message="Add new entry" # configuration file to override the above defined variables. if [ -f .callioperc ] @@ -32,13 +33,6 @@ then fi -# if commit_message is not set or provided on command, use default -default_commit_message="Add new entry" -if [ -z ${commit_message+x} ] -then - commit_message="$default_commit_message" -fi - add_entry () { echo "Today is $year/$month/$day" @@ -459,9 +453,9 @@ commit_changes () exit -1 else encrypt_all && remove_unencrpyted - echo "Committing changes to repository with commit message $commit_message" + echo "Committing changes to repository with commit message ${commit_message:-default_commit_message}" git add . - if ! git commit -m "$commit_message" + if ! git commit -m "${commit_message:-default_commit_message}" then echo "Commit failed. Please check the output and commit manually." exit -1