.github: scripts: git-smart-checkout.sh

pull submodules if existing

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-12-14 11:30:46 +01:00
committed by Enrico Weigelt
parent 857e397c15
commit a897fecfcf

View File

@@ -153,7 +153,7 @@ else
clone_ok=0 clone_ok=0
for u in "${URLS[@]}"; do for u in "${URLS[@]}"; do
log_info "Clone von $u -> $NAME (minimaler Transfer, no-checkout)" log_info "Clone von $u -> $NAME (minimaler Transfer, no-checkout)"
clone_cmd=( git clone "--no-checkout" "--origin=origin" "$u" "$NAME" ) clone_cmd=( git clone "--recurse-submodules" "--no-checkout" "--origin=origin" "$u" "$NAME" )
(( USE_PARTIAL )) && clone_cmd+=( "--filter=blob:none" ) (( USE_PARTIAL )) && clone_cmd+=( "--filter=blob:none" )
(( FETCH_TAGS == 0 )) && clone_cmd+=( "--no-tags" ) (( FETCH_TAGS == 0 )) && clone_cmd+=( "--no-tags" )
if git_retry "clone $u" "${clone_cmd[@]}"; then if git_retry "clone $u" "${clone_cmd[@]}"; then
@@ -258,6 +258,7 @@ log_info "forced checkout (detached) auf $TARGET_COMMIT"
# Ensure no stray temp ref prevents checkout # Ensure no stray temp ref prevents checkout
git update-ref -d "refs/tmp/$REF" >/dev/null 2>&1 || true git update-ref -d "refs/tmp/$REF" >/dev/null 2>&1 || true
git checkout --force --detach "$TARGET_COMMIT" git checkout --force --detach "$TARGET_COMMIT"
git submodule update --init
# Small summary # Small summary
log_info "working dir:" log_info "working dir:"