Post 1.0.0 development track.
[git/jnareb-git/bp-gitweb.git] / git-push.sh
blob1c5cf80f8786eb20c6092a8fbce48e1f1c1cb9e1
1 #!/bin/sh
3 USAGE='[--all] [--force] <repository> [<refspec>...]'
4 . git-sh-setup
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=
13 while case "$#" in 0) break ;; esac
15 case "$1" in
16 --all)
17 has_all=--all ;;
18 --force)
19 has_force=--force ;;
20 --exec=*)
21 has_exec="$1" ;;
22 -*)
23 usage ;;
25 set x "$@"
26 shift
27 break ;;
28 esac
29 shift
30 done
31 case "$#" in
33 echo "Where would you want to push today?"
34 usage ;;
35 esac
37 . git-parse-remote
38 remote=$(get_remote_url "$@")
39 case "$has_all" in
40 --all) set x ;;
41 '') set x $(get_remote_refs_for_push "$@") ;;
42 esac
43 shift
45 case "$remote" in
46 git://*)
47 die "Cannot use READ-ONLY transport to push to $remote" ;;
48 rsync://*)
49 die "Pushing with rsync transport is deprecated" ;;
50 esac
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
57 case "$remote" in
58 http://* | https://*)
59 exec git-http-push "$@";;
61 exec git-send-pack "$@";;
62 esac