From cd95974e4817723850aa1c0c51b4ae8c572e8e1e Mon Sep 17 00:00:00 2001 From: Padreug Date: Sat, 20 Jun 2026 09:51:31 +0200 Subject: [PATCH] fix(dev-env): count deleted backups in the parent shell, not a subshell cleanup_backups piped `git branch --list` into `while read`, so the `deleted` counter incremented inside a pipeline subshell and never propagated. The closing "Deleted N backup branch(es)" always reported 0, however many were actually removed. Switch the inner loop to process substitution (matching the outer find_forked_repos loop) so the count survives. --- modules/dev-env/scripts/rebase.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/dev-env/scripts/rebase.sh b/modules/dev-env/scripts/rebase.sh index 60078ca..c311adb 100644 --- a/modules/dev-env/scripts/rebase.sh +++ b/modules/dev-env/scripts/rebase.sh @@ -311,7 +311,7 @@ cleanup_backups() { local deleted=0 while IFS=: read -r path _; do cd "$path" || continue - git branch --list "backup/*" 2>/dev/null | while read -r branch; do + while read -r branch; do branch="$(echo "$branch" | tr -d ' *')" local bdate bdate="$(echo "$branch" | grep -oE '[0-9]{8}' | head -1)" @@ -319,7 +319,7 @@ cleanup_backups() { || { [[ -n "$bdate" ]] && [[ "$bdate" < "$cutoff" ]]; }; then git branch -D "$branch" 2>/dev/null && deleted=$((deleted + 1)) || true fi - done + done < <(git branch --list "backup/*" 2>/dev/null) done < <(find_forked_repos) success "Deleted $deleted backup branch(es)." }