From: Daan De Meyer Date: Thu, 29 Aug 2024 16:36:55 +0000 (+0200) Subject: mkosi: Don't fetch remote if the commit to check out already exists X-Git-Tag: v257-rc1~594 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5730846fe78518fb9fdabaedfd6f20eb5568582;p=thirdparty%2Fsystemd.git 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. --- diff --git a/mkosi.images/build/mkosi.sync b/mkosi.images/build/mkosi.sync index febe893c41f..4cb2b41a4e2 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