[PATCH] Make .git directory validation code test HEAD
[git/trast.git] / git-push-script
blob5fa5af2af896e3bf6854387e744b9d2643a8f510
1 #!/bin/sh
2 . git-sh-setup-script || die "Not a git archive"
4 # Parse out parameters and then stop at remote, so that we can
5 # translate it using .git/branches information
6 has_all=
7 has_force=
8 has_exec=
9 remote=
11 while case "$#" in 0) break ;; esac
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" ;;
23 set x "$@"
24 shift
25 break ;;
26 esac
27 shift
28 done
30 . git-parse-remote-script
31 remote=$(get_remote_url "$@")
32 case "$has_all" in
33 --all) set x ;;
34 '') set x $(get_remote_refs_for_push "$@") ;;
35 esac
36 shift
38 case "$remote" in
39 http://* | https://* | git://* | rsync://* )
40 die "Cannot push to $remote" ;;
41 esac
43 set x "$remote" "$@"; shift
44 test "$has_all" && set x "$has_all" "$@" && shift
45 test "$has_force" && set x "$has_force" "$@" && shift
46 test "$has_exec" && set x "$has_exec" "$@" && shift
48 exec git-send-pack "$@"