]> git.ipfire.org Git - thirdparty/git.git/blame - git-push.sh
sha1_to_hex: properly terminate the SHA1
[thirdparty/git.git] / git-push.sh
CommitLineData
51cb06c3 1#!/bin/sh
c4851047 2
806f36d4
FK
3USAGE='[--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
8has_all=
9has_force=
10has_exec=
11remote=
12
13while case "$#" in 0) break ;; esac
14do
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
30done
9a9cbb6e
JH
31case "$#" in
320)
f9362de9
CS
33 echo "Where would you want to push today?"
34 usage ;;
9a9cbb6e 35esac
46b1c7c0 36
215a7ad1 37. git-parse-remote
ac4b0cff
JH
38remote=$(get_remote_url "$@")
39case "$has_all" in
40--all) set x ;;
41'') set x $(get_remote_refs_for_push "$@") ;;
46b1c7c0 42esac
ac4b0cff 43shift
46b1c7c0
JH
44
45case "$remote" in
df8171cc 46git://*)
c4851047
CS
47 die "Cannot use READ-ONLY transport to push to $remote" ;;
48rsync://*)
49 die "Pushing with rsync transport is deprecated" ;;
46b1c7c0
JH
50esac
51
52set x "$remote" "$@"; shift
53test "$has_all" && set x "$has_all" "$@" && shift
54test "$has_force" && set x "$has_force" "$@" && shift
55test "$has_exec" && set x "$has_exec" "$@" && shift
56
df8171cc
NH
57case "$remote" in
58http://* | https://*)
59 exec git-http-push "$@";;
60*)
61 exec git-send-pack "$@";;
62esac