summaryrefslogtreecommitdiffstats
path: root/mkosi.images/build
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-08-29 18:36:55 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2024-08-29 20:16:19 +0200
commitc5730846fe78518fb9fdabaedfd6f20eb5568582 (patch)
tree0a2964a7c40dd8388e4e0185ff3d06248829eaf3 /mkosi.images/build
parent hwdb.d/60-keyboard.hwdb: add Clevo mic mute quirk for V5x dGPU (diff)
downloadsystemd-c5730846fe78518fb9fdabaedfd6f20eb5568582.tar.xz
systemd-c5730846fe78518fb9fdabaedfd6f20eb5568582.zip
mkosi: Don't fetch remote if the commit to check out already exists
If the commit we're about to check out already exists in the local repository, don't fetch from the remote repository.
Diffstat (limited to 'mkosi.images/build')
-rwxr-xr-xmkosi.images/build/mkosi.sync2
1 files changed, 1 insertions, 1 deletions
diff --git a/mkosi.images/build/mkosi.sync b/mkosi.images/build/mkosi.sync
index febe893c41..4cb2b41a4e 100755
--- a/mkosi.images/build/mkosi.sync
+++ b/mkosi.images/build/mkosi.sync
@@ -43,7 +43,7 @@ if [[ ! -e "pkg/$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "pkg/$PKG_SUBDIR")"
# --no-cone is needed to check out only one top-level directory
git -C "pkg/$PKG_SUBDIR" sparse-checkout set --no-cone "${GIT_SUBDIR:-}"
fi
-else
+elif ! git -C "pkg/$PKG_SUBDIR" cat-file -e "$GIT_COMMIT^{commit}"; then
git -C "pkg/$PKG_SUBDIR" remote set-url origin "$GIT_URL"
git -C "pkg/$PKG_SUBDIR" fetch origin "$GIT_BRANCH"
fi