X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-push-script;h=744ee7e7dc8986767f410f99f4ff8c644654b172;hb=e70a165d3db26dbab62e3430553a21d5e97b74ec;hp=70fa9684a51be3dbbcb83460c32bb8d7fe1b4cf0;hpb=46b1c7c03c3ae3bf17aa87bf9ae2f9fb38d08789;p=git.git diff --git a/git-push-script b/git-push-script index 70fa9684..744ee7e7 100755 --- a/git-push-script +++ b/git-push-script @@ -20,36 +20,24 @@ do -*) die "Unknown parameter $1" ;; *) - remote="$1" - shift set x "$@" shift break ;; esac shift done +case "$#" in +0) + die "Where would you want to push today?" ;; +esac -case "$remote" in -*:* | /* | ../* | ./* ) - # An URL, host:/path/to/git, absolute and relative paths. - ;; -* ) - # Shorthand - if expr "$remote" : '..*/..*' >/dev/null - then - # a short-hand followed by a trailing path - shorthand=$(expr "$remote" : '\([^/]*\)') - remainder=$(expr "$remote" : '[^/]*\(/.*\)$') - else - shorthand="$remote" - remainder= - fi - remote=$(sed -e 's/#.*//' "$GIT_DIR/branches/$remote") && - expr "$remote" : '..*:' >/dev/null && - remote="$remote$remainder" || - die "Cannot parse remote $remote" - ;; +. git-parse-remote-script +remote=$(get_remote_url "$@") +case "$has_all" in +--all) set x ;; +'') set x $(get_remote_refs_for_push "$@") ;; esac +shift case "$remote" in http://* | https://* | git://* | rsync://* )