diff --git a/mkosi.images/system/mkosi.sync b/mkosi.images/system/mkosi.sync index fef0e3b138..d00a776257 100755 --- a/mkosi.images/system/mkosi.sync +++ b/mkosi.images/system/mkosi.sync @@ -9,8 +9,15 @@ fi PKG_SUBDIR="$(realpath --canonicalize-missing "pkg/$DISTRIBUTION" --relative-to "$PWD")" -if [[ -d "$PKG_SUBDIR/.git" ]] && [[ "$(git -C "$PKG_SUBDIR" rev-parse HEAD)" == "$GIT_COMMIT" ]]; then - exit 0 +if [[ -d "$PKG_SUBDIR/.git" ]]; then + if [[ "$(git -C "$PKG_SUBDIR" rev-parse HEAD)" == "$GIT_COMMIT" ]]; then + exit 0 + fi + + # 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 + fi fi if [[ ! -e "$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "$PKG_SUBDIR")" ]]; then