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