fix(template.sh): fix decription for non git directory

When we are in a non-git folder, if we use the 'gct' command, we will also see the reason for the error.
This commit is contained in:
ghasem shirdel 2022-01-10 09:22:24 +03:30
parent 51f6a87435
commit 0e1841b6d6

View File

@ -1,6 +1,7 @@
git_commit_template() {
# Check in this directory git exist
if [ ! -d .git ]; then
echo "fatal: not a git repository (or any of the parent directories): .git"
exit 1
fi
@ -107,6 +108,7 @@ octo-org/octo-repo#100\n\n"
fi
printf "\n ${GREEN}${type_var}${scope}: ${short_desc}
${long_desc}
${breaking_changes}
${closed_issues}${RESET}\n\n"
@ -115,6 +117,7 @@ octo-org/octo-repo#100\n\n"
result_code=$?
if [ "$result_code" = 0 ]; then
git commit -m "${type_var}${scope}: ${short_desc}
${long_desc}
${breaking_changes}
${closed_issues}"