From ed582962a4110d92dbb8b595140aed6574761220 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Mon, 22 Nov 2021 10:29:51 +0100 Subject: [PATCH] fix: dev: [gogocarto] don't fail if no change in last code version If we loose the `.version` file for some reason (this should not happen). Don't try to commit an empty commit. Signed-off-by: Valentin Lab --- gogocarto/lib/common | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gogocarto/lib/common b/gogocarto/lib/common index cb6e17e..b5da873 100644 --- a/gogocarto/lib/common +++ b/gogocarto/lib/common @@ -37,8 +37,18 @@ gogocarto:init() { return 1 } echo "$GOGOCARTO_RELEASE" > .version - git add -A . && - git commit -m "Release $GOGOCARTO_RELEASE" + git add -A . || { + err "'git add -A .' in '${GOGOCARTO_CODE}' failed." + return 1 + } + if git diff --staged -s --exit-code; then + info "No differences with last saved version." + else + git commit -m "Release $GOGOCARTO_RELEASE" || { + err "'git commit' failed." + return 1 + } + fi fi }