2f2c0eaffc80797cdd7c247cdb911a268041b81c

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Update gsrb to support force pushing

Diff

 1diff --git a/dot_local/bin/executable_gsrb b/dot_local/bin/executable_gsrb
 2index 5098ed49fd63d57ff1aa739cea5209d9305ece98..577401fe9fbf60a733b1a0e891d18fc1c3012344 100644
 3--- a/dot_local/bin/executable_gsrb
 4+++ b/dot_local/bin/executable_gsrb
 5@@ -26,11 +26,13 @@ function git_main_branch() {
 6 
 7 interactive=""
 8 abort=false
 9-while getopts "ia" opt; do
10+push=false
11+while getopts "iap" opt; do
12 	case $opt in
13 		i) interactive="-i" ;;
14 		a) abort=true ;;
15-		*) echo "usage: gsrb [-i] [-a] [base]" >&2; exit 1 ;;
16+		p) push=true ;;
17+		*) echo "usage: gsrb [-i] [-a] [-p] [base]" >&2; exit 1 ;;
18 	esac
19 done
20 shift $((OPTIND - 1))
21@@ -54,6 +56,7 @@ fi
22 
23 typeset -A old_tips
24 remaining=()
25+rebased=()
26 
27 if [ -f "$statefile" ]; then
28 	while IFS=' ' read -r key val; do
29@@ -123,12 +126,18 @@ while (( ${#remaining} > 0 )); do
30 		exit 1
31 	fi
32 
33+	rebased+=("$b")
34 	prev_old="$old"
35 	prev="$b"
36 done
37 
38 rm -f "$statefile"
39 
40+if $push && (( ${#rebased} > 0 )); then
41+	echo "pushing ${#rebased} branches"
42+	git push --force-with-lease origin "${rebased[@]}"
43+fi
44+
45 if [ -n "$current" ] && [ "$current" != "$b" ]; then
46 	git checkout "$current"
47 fi