From 2afec8f149d17ab17d096d3ac372c07cd2f343d6 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Sun, 31 May 2026 07:40:32 -0700 Subject: [PATCH] sync: auto-sync from GURU-KALI at 2026-05-31 07:40:31 Author: Mike Swanson Machine: GURU-KALI Timestamp: 2026-05-31 07:40:31 --- .claude/scripts/sync.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.claude/scripts/sync.sh b/.claude/scripts/sync.sh index 1352854..9a05adf 100755 --- a/.claude/scripts/sync.sh +++ b/.claude/scripts/sync.sh @@ -269,7 +269,12 @@ echo "=== Phase 2: Fetch + inspect ===" LOCAL_BEFORE=$(git rev-parse HEAD) echo -e "${GREEN}[OK]${NC} Fetching from origin..." -git fetch origin --quiet +# --no-recurse-submodules: parent fetch must NOT implicitly recurse. A transient +# dead gitlink in incoming parent history (force-pushed-out submodule commit) +# would otherwise abort the whole sync under `set -e`. Phase 1a already advanced +# submodules to their remote tips; a post-rebase `git submodule update` reconciles +# them to the new parent pointers. +git fetch origin --quiet --no-recurse-submodules LOCAL=$(git rev-parse HEAD) REMOTE=$(git rev-parse origin/main 2>/dev/null || git rev-parse origin/master 2>/dev/null || echo "$LOCAL") @@ -330,12 +335,25 @@ fi if [ "$INCOMING_COUNT" -gt 0 ]; then echo "" echo "=== Phase 3: Pull (rebase) ===" - if git pull origin main --rebase; then + # --no-recurse-submodules: same reason as the fetch above — don't let a + # dead submodule ref in incoming history kill the parent rebase. + if git pull origin main --rebase --no-recurse-submodules; then echo -e "${GREEN}[OK]${NC} Pulled successfully." else echo -e "${RED}[ERROR]${NC} Pull failed (likely conflicts). Resolve and re-run sync." exit 1 fi + + # Submodules may have advanced via the parent's gitlinks. Update them to match, + # but tolerate per-submodule failures (e.g., transient dead refs in history) — + # the working tree is still useful even if one submodule can't catch up. + set +e + git submodule update --init --recursive --quiet 2>&1 | grep -v '^$' || true + SUB_RC=${PIPESTATUS[0]} + set -e + if [ "$SUB_RC" -ne 0 ]; then + echo -e "${YELLOW}[WARNING]${NC} One or more submodules failed to update — likely a transient dead ref. Parent repo is current; investigate the submodule manually if a pointer is wrong." + fi fi # Phase 4: Push (if needed) @@ -460,7 +478,10 @@ else fi VAULT_LOCAL_BEFORE=$(git rev-parse HEAD) - git fetch origin --quiet + # --no-recurse-submodules: vault doesn't use submodules today, but stay + # consistent with the main-repo fetch so this script remains robust if that + # ever changes. + git fetch origin --quiet --no-recurse-submodules VAULT_REMOTE_BRANCH="origin/main" if ! git rev-parse origin/main >/dev/null 2>&1; then @@ -473,7 +494,7 @@ else if [ "$VAULT_INCOMING" -gt 0 ]; then echo -e "${CYAN}--- Vault: $VAULT_INCOMING incoming commit(s) ---${NC}" git log --oneline --format=' %C(yellow)%h%Creset %C(cyan)%an%Creset %s %C(dim)(%ar)%Creset' HEAD..$VAULT_REMOTE_BRANCH | head -10 - if git pull origin main --rebase; then + if git pull origin main --rebase --no-recurse-submodules; then echo -e "${GREEN}[OK]${NC} Vault pulled." else echo -e "${RED}[ERROR]${NC} Vault pull failed — resolve conflicts manually in $VAULT_PATH."