]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Make sure we don't hide errors from git merge-base
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 3 Jul 2024 11:19:34 +0000 (13:19 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 3 Jul 2024 13:42:12 +0000 (15:42 +0200)
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

index d00a77625737ab43e27d99a7356053e4d7ed2e2b..517b7c934675793a1db8a1f64ad9e83274bb14d2 100755 (executable)
@@ -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