git-check-all, git-update-all: arithmetic exit-code Fix (set -e)

((counter++)) gibt exit-code 1 wenn counter vorher 0 war.
Mit set -e bricht das Skript dann sofort ab. Fix: || true

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Rene 2026-03-31 14:41:39 +02:00
parent 7d35a2cd7a
commit 2f731f68e2
2 changed files with 8 additions and 8 deletions

View file

@ -89,7 +89,7 @@ dirty_repos=()
for gitdir in "${sorted_gitdirs[@]}"; do
repo_dir="${gitdir%/.git}"
((total++))
((total++)) || true
cd "$repo_dir" || continue
@ -113,10 +113,10 @@ for gitdir in "${sorted_gitdirs[@]}"; do
((behind > 0)) && is_dirty=true
if $is_dirty; then
((dirty++))
((dirty++)) || true
dirty_repos+=("$repo_dir")
else
((clean++))
((clean++)) || true
$SHOW_ALL || continue
fi

View file

@ -66,21 +66,21 @@ failed=0
for gitdir in "${sorted_gitdirs[@]}"; do
repo_dir="${gitdir%/.git}"
repo_name="${repo_dir#$BASE_DIR/}"
((total++))
((total++)) || true
cd "$repo_dir" || continue
# Lokale Aenderungen? -> ueberspringen
if [[ -n "$(git status --porcelain 2>/dev/null)" ]]; then
printf "${C_YELLOW}SKIP${C_RESET} %s (lokale Aenderungen)\n" "$repo_name"
((skipped++))
((skipped++)) || true
continue
fi
# Kein Remote? -> ueberspringen
if ! git remote | grep -q .; then
printf "${C_YELLOW}SKIP${C_RESET} %s (kein Remote)\n" "$repo_name"
((skipped++))
((skipped++)) || true
continue
fi
@ -90,11 +90,11 @@ for gitdir in "${sorted_gitdirs[@]}"; do
printf "${C_GREEN}OK${C_RESET} %s (aktuell)\n" "$repo_name"
else
printf "${C_GREEN}PULL${C_RESET} %s (aktualisiert)\n" "$repo_name"
((updated++))
((updated++)) || true
fi
else
printf "${C_RED}FAIL${C_RESET} %s\n" "$repo_name"
((failed++))
((failed++)) || true
fi
done