-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: add confirmation to archive-branches script
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
- Loading branch information
Showing
1 changed file
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|