a67f47df8ea4cdd3c916afdea6791f7e64571e7c
   1#!/bin/sh
   2. git-sh-setup || die "Not a git archive"
   3
   4# Parse out parameters and then stop at remote, so that we can
   5# translate it using .git/branches information
   6has_all=
   7has_force=
   8has_exec=
   9remote=
  10
  11while case "$#" in 0) break ;; esac
  12do
  13        case "$1" in
  14        --all)
  15                has_all=--all ;;
  16        --force)
  17                has_force=--force ;;
  18        --exec=*)
  19                has_exec="$1" ;;
  20        -*)
  21                die "Unknown parameter $1" ;;
  22        *)
  23                set x "$@"
  24                shift
  25                break ;;
  26        esac
  27        shift
  28done
  29case "$#" in
  300)
  31        echo "Where would you want to push today?"
  32        usage ;;
  33esac
  34
  35. git-parse-remote
  36remote=$(get_remote_url "$@")
  37case "$has_all" in
  38--all) set x ;;
  39'')    set x $(get_remote_refs_for_push "$@") ;;
  40esac
  41shift
  42
  43case "$remote" in
  44http://* | https://* | git://* | rsync://* )
  45        die "Cannot push to $remote" ;;
  46esac
  47
  48set x "$remote" "$@"; shift
  49test "$has_all" && set x "$has_all" "$@" && shift
  50test "$has_force" && set x "$has_force" "$@" && shift
  51test "$has_exec" && set x "$has_exec" "$@" && shift
  52
  53exec git-send-pack "$@"