Linus Torvalds | 51cb06c | 2005-07-08 21:24:25 | [diff] [blame] | 1 | #!/bin/sh |
Junio C Hamano | 215a7ad | 2005-09-08 00:26:23 | [diff] [blame] | 2 | . git-sh-setup || die "Not a git archive" |
Junio C Hamano | 46b1c7c | 2005-08-08 05:55:45 | [diff] [blame] | 3 | |
| 4 | # Parse out parameters and then stop at remote, so that we can |
| 5 | # translate it using .git/branches information |
| 6 | has_all= |
| 7 | has_force= |
| 8 | has_exec= |
| 9 | remote= |
| 10 | |
| 11 | while case "$#" in 0) break ;; esac |
| 12 | do |
| 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 Hamano | 46b1c7c | 2005-08-08 05:55:45 | [diff] [blame] | 23 | set x "$@" |
| 24 | shift |
| 25 | break ;; |
| 26 | esac |
| 27 | shift |
| 28 | done |
Junio C Hamano | 9a9cbb6 | 2005-08-26 17:37:17 | [diff] [blame] | 29 | case "$#" in |
| 30 | 0) |
| 31 | die "Where would you want to push today?" ;; |
| 32 | esac |
Junio C Hamano | 46b1c7c | 2005-08-08 05:55:45 | [diff] [blame] | 33 | |
Junio C Hamano | 215a7ad | 2005-09-08 00:26:23 | [diff] [blame] | 34 | . git-parse-remote |
Junio C Hamano | ac4b0cf | 2005-08-20 09:52:24 | [diff] [blame] | 35 | remote=$(get_remote_url "$@") |
| 36 | case "$has_all" in |
| 37 | --all) set x ;; |
| 38 | '') set x $(get_remote_refs_for_push "$@") ;; |
Junio C Hamano | 46b1c7c | 2005-08-08 05:55:45 | [diff] [blame] | 39 | esac |
Junio C Hamano | ac4b0cf | 2005-08-20 09:52:24 | [diff] [blame] | 40 | shift |
Junio C Hamano | 46b1c7c | 2005-08-08 05:55:45 | [diff] [blame] | 41 | |
| 42 | case "$remote" in |
| 43 | http://* | https://* | git://* | rsync://* ) |
| 44 | die "Cannot push to $remote" ;; |
| 45 | esac |
| 46 | |
| 47 | set x "$remote" "$@"; shift |
| 48 | test "$has_all" && set x "$has_all" "$@" && shift |
| 49 | test "$has_force" && set x "$has_force" "$@" && shift |
| 50 | test "$has_exec" && set x "$has_exec" "$@" && shift |
| 51 | |
| 52 | exec git-send-pack "$@" |