]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Don't touch the packaging checkout if work is being done
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 Jul 2024 20:27:01 +0000 (22:27 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 2 Jul 2024 23:17:35 +0000 (01:17 +0200)
If work is being done in a separate branch, don't touch the packaging
checkout.

mkosi.images/system/mkosi.sync

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