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.
This commit is contained in:
Daan De Meyer 2024-07-03 13:19:34 +02:00 committed by Luca Boccassi
parent 4ee0ac1ae4
commit 2fe6ad5a64

View file

@ -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