git-push.shon commit Merge branch 'fk/usage' (b0d3e9b)
   1#!/bin/sh
   2
   3USAGE='[--all] [--force] <repository> [<refspec>...]'
   4. git-sh-setup
   5
   6# Parse out parameters and then stop at remote, so that we can
   7# translate it using .git/branches information
   8has_all=
   9has_force=
  10has_exec=
  11remote=
  12
  13while case "$#" in 0) break ;; esac
  14do
  15        case "$1" in
  16        --all)
  17                has_all=--all ;;
  18        --force)
  19                has_force=--force ;;
  20        --exec=*)
  21                has_exec="$1" ;;
  22        -*)
  23                usage ;;
  24        *)
  25                set x "$@"
  26                shift
  27                break ;;
  28        esac
  29        shift
  30done
  31case "$#" in
  320)
  33        echo "Where would you want to push today?"
  34        usage ;;
  35esac
  36
  37. git-parse-remote
  38remote=$(get_remote_url "$@")
  39case "$has_all" in
  40--all) set x ;;
  41'')    set x $(get_remote_refs_for_push "$@") ;;
  42esac
  43shift
  44
  45case "$remote" in
  46git://*)
  47        die "Cannot use READ-ONLY transport to push to $remote" ;;
  48rsync://*)
  49        die "Pushing with rsync transport is deprecated" ;;
  50esac
  51
  52set x "$remote" "$@"; shift
  53test "$has_all" && set x "$has_all" "$@" && shift
  54test "$has_force" && set x "$has_force" "$@" && shift
  55test "$has_exec" && set x "$has_exec" "$@" && shift
  56
  57case "$remote" in
  58http://* | https://*)
  59        exec git-http-push "$@";;
  60*)
  61        exec git-send-pack "$@";;
  62esac