blob: 00d715059c4b751bef9adaf3debbe56ae1cf19ac [file] [log] [blame]
Linus Torvalds51cb06c2005-07-08 21:24:251#!/bin/sh
Junio C Hamano215a7ad2005-09-08 00:26:232. git-sh-setup || die "Not a git archive"
Junio C Hamano46b1c7c2005-08-08 05:55:453
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 *)
Junio C Hamano46b1c7c2005-08-08 05:55:4523 set x "$@"
24 shift
25 break ;;
26 esac
27 shift
28done
Junio C Hamano9a9cbb62005-08-26 17:37:1729case "$#" in
300)
31 die "Where would you want to push today?" ;;
32esac
Junio C Hamano46b1c7c2005-08-08 05:55:4533
Junio C Hamano215a7ad2005-09-08 00:26:2334. git-parse-remote
Junio C Hamanoac4b0cf2005-08-20 09:52:2435remote=$(get_remote_url "$@")
36case "$has_all" in
37--all) set x ;;
38'') set x $(get_remote_refs_for_push "$@") ;;
Junio C Hamano46b1c7c2005-08-08 05:55:4539esac
Junio C Hamanoac4b0cf2005-08-20 09:52:2440shift
Junio C Hamano46b1c7c2005-08-08 05:55:4541
42case "$remote" in
43http://* | https://* | git://* | rsync://* )
44 die "Cannot push to $remote" ;;
45esac
46
47set x "$remote" "$@"; shift
48test "$has_all" && set x "$has_all" "$@" && shift
49test "$has_force" && set x "$has_force" "$@" && shift
50test "$has_exec" && set x "$has_exec" "$@" && shift
51
52exec git-send-pack "$@"