[PATCH] format-patch: always --mbox and show sane Date:
[git/mingw.git] / git-push.sh
blob136093bf138f57d45385c0d71344b4cd85c472d6
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=
12 do_tags=
14 while case "$#" in 0) break ;; esac
16 case "$1" in
17 --all)
18 has_all=--all ;;
19 --tags)
20 do_tags=yes ;;
21 --force)
22 has_force=--force ;;
23 --exec=*)
24 has_exec="$1" ;;
25 -*)
26 usage ;;
28 set x "$@"
29 shift
30 break ;;
31 esac
32 shift
33 done
34 case "$#" in
36 echo "Where would you want to push today?"
37 usage ;;
38 esac
39 if test ",$has_all,$do_tags," = ",--all,yes,"
40 then
41 do_tags=
44 . git-parse-remote
45 remote=$(get_remote_url "$@")
46 case "$has_all" in
47 --all) set x ;;
48 '') set x $(get_remote_refs_for_push "$@") ;;
49 esac
50 shift
52 case "$do_tags" in
53 yes)
54 set "$@" $(cd "$GIT_DIR/refs" && find tags -type f -print) ;;
55 esac
57 # Now we have explicit refs from the command line or from remotes/
58 # shorthand, or --tags. Falling back on the current branch if we still
59 # do not have any may be an alternative, but prevent mistakes for now.
61 case "$#,$has_all" in
62 0,)
63 die "No refs given to be pushed." ;;
64 esac
66 case "$remote" in
67 git://*)
68 die "Cannot use READ-ONLY transport to push to $remote" ;;
69 rsync://*)
70 die "Pushing with rsync transport is deprecated" ;;
71 esac
73 set x "$remote" "$@"; shift
74 test "$has_all" && set x "$has_all" "$@" && shift
75 test "$has_force" && set x "$has_force" "$@" && shift
76 test "$has_exec" && set x "$has_exec" "$@" && shift
78 case "$remote" in
79 http://* | https://*)
80 exec git-http-push "$@";;
82 exec git-send-pack "$@";;
83 esac