Skip to content

Commit cf7ee94

Browse files
committed
Meta/pushall: make it safer to rewind next
1 parent 92d6a78 commit cf7ee94

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

pushall

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,40 @@
11
#!/bin/sh
22

33
sites='ko repo github2 sfjp sf.net gph '
4+
nexts='ko repo gph github2'
45

5-
while :
6-
do
7-
failed=
8-
for remote in $sites
6+
push_retry () {
7+
sites=$1
8+
shift
9+
while :
910
do
10-
printf "%s: " "$remote"
11-
git push --follow-tags "$remote" "$@" || failed="$failed$remote "
11+
failed=
12+
for remote in $sites
13+
do
14+
printf "%s: " "$remote"
15+
git push --follow-tags "$remote" "$@" || failed="$failed$remote "
16+
done
17+
18+
if test -z "$failed"
19+
then
20+
break
21+
elif test "x$sites" = "x$failed"
22+
then
23+
echo >&2 "Failed to push to: $sites"
24+
exit 1
25+
fi
26+
sites="$failed"
1227
done
28+
}
29+
30+
case " $* " in
31+
*' +next '*)
32+
push_retry "$nexts" "$@"
33+
exit $?
34+
;;
35+
esac
1336

14-
if test -z "$failed"
15-
then
16-
break
17-
elif test "x$sites" = "x$failed"
18-
then
19-
echo >&2 "Failed to push to: $sites"
20-
exit 1
21-
fi
22-
sites="$failed"
23-
done
37+
push_retry "$sites" "$@"
2438

2539
case "$#,$*" in
2640
0,* | 1,-n)

0 commit comments

Comments
 (0)