]> git.wh0rd.org Git - home.git/commitdiff
r: handle random remotes better
authorMike Frysinger <vapier@gentoo.org>
Thu, 18 Apr 2013 22:37:59 +0000 (18:37 -0400)
committerMike Frysinger <vapier@gentoo.org>
Thu, 18 Apr 2013 22:37:59 +0000 (18:37 -0400)
.bin/r

diff --git a/.bin/r b/.bin/r
index af59962dd8b7416378ba06f727d09b82bceaddeb..90452b239b8609496d0d9e92b225bdbd3af42052 100755 (executable)
--- a/.bin/r
+++ b/.bin/r
@@ -165,6 +165,11 @@ g-push)
        if ! remote_branch=$(g cfg --get "branch.${branch}.merge") ; then
                err "could not figure out remote branch"
        fi
+       if ! remote=$(g cfg --get "branch.${branch}.remote") ; then
+               for remote in cros-internal cros origin ; do
+                        g cfg --get "remote.${remote}.url" >/dev/null && break
+               done
+       fi
        remote_branch=${remote_branch#refs/heads/}
 
        git_args=()
@@ -190,12 +195,7 @@ g-push)
                git_args+=( "--receive-pack=git receive-pack ${reviewers[*]/#/--reviewer=}" )
        fi
 
-       for remote in cros-internal cros origin ; do
-               if g cfg --get "remote.${remote}.url" >/dev/null ; then
-                       vr git push "${git_args[@]}" ${remote} ${branch}:refs/for/${remote_branch}
-                       exit $?
-               fi
-       done
+       vr git push "${git_args[@]}" ${remote} ${branch}:refs/for/${remote_branch} && exit
        err "could not figure out remote to push to"
        ;;
 sync)