diff --git a/bin/archive-branches.sh b/bin/archive-branches.sh index b2cca5d37133..c479a1923152 100755 --- a/bin/archive-branches.sh +++ b/bin/archive-branches.sh @@ -48,9 +48,20 @@ active_branches() { git remote add archived "git@github.com:$org/$arch_repo.git" || true -cat <(active_branches) <(pr_branches) <((IFS=$'\n'; echo "${exclusions[*]}")) \ - | sort -u | comm - <(origin_refs | sort) -13 |\ - while read -r ref; do +branches_to_move="$(cat <(active_branches) <(pr_branches) <((IFS=$'\n'; echo "${exclusions[*]}")) | sort -u | comm - <(origin_refs | sort) -13)" + +echo "Please confirm move of following branches:" +printf "%s" "$branches_to_move" + +read line +case $line in + [Yy]|[Yy][Ee][Ss]) ;; + *) exit 1 ;; +esac + + +printf "%s" "$branches_to_move" | \ +while read -r ref; do git push archived "origin/$ref:refs/heads/$ref/$(date --rfc-3339=date)" git push origin --delete "$ref" done