Skip to content

Commit

Permalink
misc: add confirmation to archive-branches script
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
  • Loading branch information
Kubuxu committed Mar 9, 2018
1 parent 5622cc5 commit 5289761
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions bin/archive-branches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ active_branches() {

git remote add archived "[email protected]:$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
Expand Down

0 comments on commit 5289761

Please sign in to comment.