diff options
author | Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com> | 2021-02-19 07:13:17 +0300 |
---|---|---|
committer | Paul Spooren <mail@aparcar.org> | 2021-02-20 09:35:41 +0300 |
commit | 89fdaa4ef07941ec77449275c785cb69b78a1dd0 (patch) | |
tree | 37f855cf50f58ca6ec0720830625650cadf32671 | |
parent | b385dcad35c0dd7d1359ec4e3d391e1657608b98 (diff) |
clean up and print error on refresh fail
set -e causes bash to exit right away on cmd failure. So run the command
inside the if statement to get a chance to clean up and print an error
message.
https://github.com/koalaman/shellcheck/wiki/SC2181
https://superuser.com/a/940542
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#The-Set-Builtin
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
-rwxr-xr-x | entrypoint.sh | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/entrypoint.sh b/entrypoint.sh index 95f266c..471863a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -72,8 +72,7 @@ else "package/$PKG/refresh" V=s || \ exit $? - git -C "$PATCHES_DIR" diff --quiet -- . - if [ $? -ne 0 ]; then + if ! git -C "$PATCHES_DIR" diff --quiet -- .; then echo "Dirty patches detected, please refresh and review the diff" git -C "$PATCHES_DIR" checkout -- . exit 1 |