Skip to content

Commit

Permalink
fix: use param expansion for default commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed May 2, 2022
1 parent 7fbff65 commit 4655227
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions calliope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4655227

Please sign in to comment.