From 3690971cd0d11749e82bc1cb69d5a1e80284ab46 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 6 Jun 2024 13:23:17 +0200 Subject: [PATCH] mkosi: move variable to the right scope --- mkosi.images/system/mkosi.sync | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mkosi.images/system/mkosi.sync b/mkosi.images/system/mkosi.sync index d21ecd19808..fef0e3b1381 100755 --- a/mkosi.images/system/mkosi.sync +++ b/mkosi.images/system/mkosi.sync @@ -13,16 +13,16 @@ if [[ -d "$PKG_SUBDIR/.git" ]] && [[ "$(git -C "$PKG_SUBDIR" rev-parse HEAD)" == exit 0 fi -# The repository on Salsa has the full upstream sources, so it's a waste of space to -# redownload and duplicate everything, so do a sparse checkout as we only need the -# packaging directory anyway -if [[ -n "${GIT_SUBDIR:-}" ]]; then - sparse=(--no-checkout --filter=tree:0) -else - sparse=() -fi - if [[ ! -e "$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "$PKG_SUBDIR")" ]]; then + # The repository on Salsa has the full upstream sources, so it's a waste of + # space to redownload and duplicate everything, so do a sparse checkout as + # we only need the packaging directory anyway. + if [[ -n "${GIT_SUBDIR:-}" ]]; then + sparse=(--no-checkout --filter=tree:0) + else + sparse=() + fi + git clone "$GIT_URL" --branch "$GIT_BRANCH" "${sparse[@]}" "$PKG_SUBDIR" if [[ -n "${GIT_SUBDIR:-}" ]]; then # --no-cone is needed to check out only one top-level directory -- 2.47.3