]> git.ozlabs.org Git - next-scripts/blob - remove_oldest
updates
[next-scripts] / remove_oldest
1 #!/bin/bash
2
3 oldest=$(git tag -l next-\* | head -n 1)
4 [ "$oldest" ] || {
5         echo "Could not find oldest next- tag" 1>&2
6         exit 1
7 }
8 od=${oldest#next-}
9 [ "$od" = "$oldest" ] && {
10         echo "Hmmm, oldest next- tag '$oldest' does not start with next-" 1>&2
11         exit 1
12 }
13
14 git tag -d $oldest
15 git push korg --delete $oldest
16 for r in $(git for-each-ref --format='%(refname)' "refs/next/$od"); do
17         git update-ref -d $r
18 done
19
20 exit 0