-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathgit-tag-remove
More file actions
executable file
·47 lines (36 loc) · 847 Bytes
/
git-tag-remove
File metadata and controls
executable file
·47 lines (36 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# vi: ft=sh
REMOTE=$1
PIDS=()
ERROR_FILE=$(mktemp)
usage(){
printf "USAGE: $0 <remote> tag1 tag2 ...\n"
printf "Will delete all tags locally and on <remote> matching the given tags\n"
exit 1
}
remove_tag(){
git tag -d $1 2>>$ERROR_FILE &
PIDS+=("$!") # saves all the short running tasks
git push $REMOTE --delete $1 2>>$ERROR_FILE &
PIDS+=("$!") # saves all the long running tasks
}
if [[ $# < 2 ]]; then
usage
fi
shift
while [[ "$1" != "" ]]; do
remove_tag $1
shift
done
printf "Waiting for ${#PIDS[*]} tasks to finish "
EXIT_STATUS=0
for PID in ${PIDS[*]}; do
wait $PID
let EXIT_STATUS+=$?
printf "."
done
printf "\n"
printf "\nAll background tasks finished. "
if [[ $EXIT_STATUS > 0 ]]; then
printf "Some errors occurred.\nSee %s for details\n" $ERROR_FILE
fi