blob: 5aa6531945c9e3494e34abb08d81e9ad03864521 [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
c.shoemaker@cox.netc4851042005-10-29 04:16:334usage () {
5 die "Usage: git push [--all] [--force] <repository> [<refspec>]"
6}
7
8
Junio C Hamano46b1c7c2005-08-08 05:55:459# 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 -*)
c.shoemaker@cox.netc4851042005-10-29 04:16:3326 usage ;;
Junio C Hamano46b1c7c2005-08-08 05:55:4527 *)
Junio C Hamano46b1c7c2005-08-08 05:55:4528 set x "$@"
29 shift
30 break ;;
31 esac
32 shift
33done
Junio C Hamano9a9cbb62005-08-26 17:37:1734case "$#" in
350)
c.shoemaker@cox.netf9362de2005-10-29 04:17:1736 echo "Where would you want to push today?"
37 usage ;;
Junio C Hamano9a9cbb62005-08-26 17:37:1738esac
Junio C Hamano46b1c7c2005-08-08 05:55:4539
Junio C Hamano215a7ad2005-09-08 00:26:2340. git-parse-remote
Junio C Hamanoac4b0cf2005-08-20 09:52:2441remote=$(get_remote_url "$@")
42case "$has_all" in
43--all) set x ;;
44'') set x $(get_remote_refs_for_push "$@") ;;
Junio C Hamano46b1c7c2005-08-08 05:55:4545esac
Junio C Hamanoac4b0cf2005-08-20 09:52:2446shift
Junio C Hamano46b1c7c2005-08-08 05:55:4547
48case "$remote" in
c.shoemaker@cox.netc4851042005-10-29 04:16:3349http://* | https://* | git://*)
50 die "Cannot use READ-ONLY transport to push to $remote" ;;
51rsync://*)
52 die "Pushing with rsync transport is deprecated" ;;
Junio C Hamano46b1c7c2005-08-08 05:55:4553esac
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 "$@"