From e9f89812793c9eace31d9c364ce9faef8beaa8b2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 30 Apr 2026 20:34:12 +0000 Subject: [PATCH] Fix Windows long-path failures during clone in scan-all.sh Repositories with deeply nested paths (e.g. Keycloak) fail to clone on Windows with 'Filename too long' because the working tree exceeds the 260-character MAX_PATH limit. Pass core.longpaths=true to git clone so it bypasses MAX_PATH; the flag is harmless on Linux/macOS. Also detect a partial checkout left behind by a previous failed clone and re-run checkout instead of silently scanning an incomplete tree. --- scripts/scan-all.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/scan-all.sh b/scripts/scan-all.sh index 50a5d9d..af8acc4 100755 --- a/scripts/scan-all.sh +++ b/scripts/scan-all.sh @@ -171,10 +171,21 @@ while IFS='|' read -r repo name category; do # Clone (skip if already present) if [[ -d "$clone_dir/.git" ]]; then - echo " clone already present, skipping git clone" + # A previous run may have failed mid-checkout (e.g. Windows long-path + # errors), leaving .git but an incomplete working tree. Detect missing + # tracked files and re-checkout before scanning. + if ! git -C "$clone_dir" diff --quiet HEAD -- 2>/dev/null; then + echo " previous checkout incomplete, restoring working tree..." + git -C "$clone_dir" -c core.longpaths=true checkout -- . 2>&1 | \ + sed 's/^/ /' + else + echo " clone already present, skipping git clone" + fi else echo " cloning $repo ..." - git clone --depth 1 --filter=blob:none \ + # core.longpaths=true is required on Windows for repos with paths >260 + # chars (e.g. Keycloak); harmless on Linux/macOS. + git -c core.longpaths=true clone --depth 1 --filter=blob:none \ "https://github.com/$repo.git" "$clone_dir" 2>&1 | \ sed 's/^/ /' fi