summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2019-12-06 18:05:49 +0000
committerFrediano Ziglio <fziglio@redhat.com>2019-12-06 18:06:21 +0000
commit81250a826e1cf935fa2e0234c4ab3fb0a615ef7d (patch)
tree0660c40afd6bafa9ac7b19da100075bc99500640
parentfe40cded0b1fd5b988a442ab8ee8541d87b66594 (diff)
Support multiple remotes to push
-rwxr-xr-xspice-server/rebase12
1 files changed, 9 insertions, 3 deletions
diff --git a/spice-server/rebase b/spice-server/rebase
index 23a5249..a7501d0 100755
--- a/spice-server/rebase
+++ b/spice-server/rebase
@@ -11,7 +11,8 @@
# Rebase the branches on this commit (usually origin/master)
# rebasepp.remote
# Optional.
-# Attempt to push to this remote if the upstream is set to it
+# Attempt to push to this remote if the upstream is set to it.
+# Can be a list separated by "|" (shell "case" is used)
# rebasepp.filter
# Optional.
# "grep -v" filter applied to the branch names. Allows to
@@ -76,6 +77,11 @@ if [ -n "$CUSTOM_SCRIPT" ]; then
source "$CUSTOM_SCRIPT"
fi
+remote_to_push() { return 1; }
+if [ -n "$REMOTE_PUSH" ]; then
+ eval "remote_to_push() { case \"\$1\" in $REMOTE_PUSH) return 0 ;; esac; return 1; }"
+fi
+
get_id() {
git rev-parse --revs-only "refs/$1" --
}
@@ -155,8 +161,8 @@ branch_need_push() {
local branch="$1" remote
if [ -n "$REMOTE_PUSH" ]; then
# check that the upstream for this branch is our specified remote
- remote=$(branch_get_remote "$branch") && [ "$REMOTE_PUSH" = "$remote" ] && {
- remote=$(get_id "remotes/$REMOTE_PUSH/$branch" 2> /dev/null) && {
+ remote=$(branch_get_remote "$branch") && remote_to_push "$remote" && {
+ remote=$(get_id "remotes/$remote/$branch" 2> /dev/null) && {
if [ "$remote" != "" -a "$(get_id heads/$branch)" != "$remote" ]; then
return 0
fi