]>
Commit | Line | Data |
---|---|---|
51cb06c3 | 1 | #!/bin/sh |
c4851047 | 2 | |
806f36d4 FK |
3 | USAGE='[--all] [--force] <repository> [<refspec>...]' |
4 | . git-sh-setup | |
c4851047 | 5 | |
46b1c7c0 JH |
6 | # Parse out parameters and then stop at remote, so that we can |
7 | # translate it using .git/branches information | |
8 | has_all= | |
9 | has_force= | |
10 | has_exec= | |
11 | remote= | |
12 | ||
13 | while case "$#" in 0) break ;; esac | |
14 | do | |
15 | case "$1" in | |
16 | --all) | |
17 | has_all=--all ;; | |
18 | --force) | |
19 | has_force=--force ;; | |
20 | --exec=*) | |
21 | has_exec="$1" ;; | |
22 | -*) | |
c4851047 | 23 | usage ;; |
46b1c7c0 | 24 | *) |
46b1c7c0 JH |
25 | set x "$@" |
26 | shift | |
27 | break ;; | |
28 | esac | |
29 | shift | |
30 | done | |
9a9cbb6e JH |
31 | case "$#" in |
32 | 0) | |
f9362de9 CS |
33 | echo "Where would you want to push today?" |
34 | usage ;; | |
9a9cbb6e | 35 | esac |
46b1c7c0 | 36 | |
215a7ad1 | 37 | . git-parse-remote |
ac4b0cff JH |
38 | remote=$(get_remote_url "$@") |
39 | case "$has_all" in | |
40 | --all) set x ;; | |
41 | '') set x $(get_remote_refs_for_push "$@") ;; | |
46b1c7c0 | 42 | esac |
ac4b0cff | 43 | shift |
46b1c7c0 JH |
44 | |
45 | case "$remote" in | |
df8171cc | 46 | git://*) |
c4851047 CS |
47 | die "Cannot use READ-ONLY transport to push to $remote" ;; |
48 | rsync://*) | |
49 | die "Pushing with rsync transport is deprecated" ;; | |
46b1c7c0 JH |
50 | esac |
51 | ||
52 | set x "$remote" "$@"; shift | |
53 | test "$has_all" && set x "$has_all" "$@" && shift | |
54 | test "$has_force" && set x "$has_force" "$@" && shift | |
55 | test "$has_exec" && set x "$has_exec" "$@" && shift | |
56 | ||
df8171cc NH |
57 | case "$remote" in |
58 | http://* | https://*) | |
59 | exec git-http-push "$@";; | |
60 | *) | |
61 | exec git-send-pack "$@";; | |
62 | esac |