]> git.ipfire.org Git - thirdparty/git.git/blame - git-push.sh
Adapt tutorial to cygwin and add test case
[thirdparty/git.git] / git-push.sh
CommitLineData
51cb06c3 1#!/bin/sh
215a7ad1 2. git-sh-setup || die "Not a git archive"
46b1c7c0
JH
3
4# Parse out parameters and then stop at remote, so that we can
5# translate it using .git/branches information
6has_all=
7has_force=
8has_exec=
9remote=
10
11while case "$#" in 0) break ;; esac
12do
13 case "$1" in
14 --all)
15 has_all=--all ;;
16 --force)
17 has_force=--force ;;
18 --exec=*)
19 has_exec="$1" ;;
20 -*)
21 die "Unknown parameter $1" ;;
22 *)
46b1c7c0
JH
23 set x "$@"
24 shift
25 break ;;
26 esac
27 shift
28done
9a9cbb6e
JH
29case "$#" in
300)
31 die "Where would you want to push today?" ;;
32esac
46b1c7c0 33
215a7ad1 34. git-parse-remote
ac4b0cff
JH
35remote=$(get_remote_url "$@")
36case "$has_all" in
37--all) set x ;;
38'') set x $(get_remote_refs_for_push "$@") ;;
46b1c7c0 39esac
ac4b0cff 40shift
46b1c7c0
JH
41
42case "$remote" in
43http://* | https://* | git://* | rsync://* )
44 die "Cannot push to $remote" ;;
45esac
46
47set x "$remote" "$@"; shift
48test "$has_all" && set x "$has_all" "$@" && shift
49test "$has_force" && set x "$has_force" "$@" && shift
50test "$has_exec" && set x "$has_exec" "$@" && shift
51
52exec git-send-pack "$@"