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

View file

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