From 2fe6ad5a64bca187712708d41269091c91500a35 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 3 Jul 2024 13:19:34 +0200 Subject: [PATCH] mkosi: Make sure we don't hide errors from git merge-base Currently if git merge-base fails we'll hide the error and exit with exit status 0. Let's make we only exit early if git merge-base exits with 1 which indicates the current commit is not on the target branch. Any other error is considered fatal. --- mkosi.images/system/mkosi.sync | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mkosi.images/system/mkosi.sync b/mkosi.images/system/mkosi.sync index d00a7762573..517b7c93467 100755 --- a/mkosi.images/system/mkosi.sync +++ b/mkosi.images/system/mkosi.sync @@ -16,7 +16,12 @@ if [[ -d "$PKG_SUBDIR/.git" ]]; then # If work is being done on the packaging rules in a separate branch, don't touch the checkout. if ! git merge-base --is-ancestor HEAD "origin/$GIT_BRANCH"; then - exit 0 + EXIT_STATUS=$? + if [[ $EXIT_STATUS -eq 1 ]]; then + exit 0 + else + exit $EXIT_STATUS + fi fi fi