[PATCH] Also handle CVS branches with a '/' in their name
[git.git] / git-push-script
blob70fa9684a51be3dbbcb83460c32bb8d7fe1b4cf0
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 remote="$1"
24 shift
25 set x "$@"
26 shift
27 break ;;
28 esac
29 shift
30 done
32 case "$remote" in
33 *:* | /* | ../* | ./* )
34 # An URL, host:/path/to/git, absolute and relative paths.
36 * )
37 # Shorthand
38 if expr "$remote" : '..*/..*' >/dev/null
39 then
40 # a short-hand followed by a trailing path
41 shorthand=$(expr "$remote" : '\([^/]*\)')
42 remainder=$(expr "$remote" : '[^/]*\(/.*\)$')
43 else
44 shorthand="$remote"
45 remainder=
47 remote=$(sed -e 's/#.*//' "$GIT_DIR/branches/$remote") &&
48 expr "$remote" : '..*:' >/dev/null &&
49 remote="$remote$remainder" ||
50 die "Cannot parse remote $remote"
52 esac
54 case "$remote" in
55 http://* | https://* | git://* | rsync://* )
56 die "Cannot push to $remote" ;;
57 esac
59 set x "$remote" "$@"; shift
60 test "$has_all" && set x "$has_all" "$@" && shift
61 test "$has_force" && set x "$has_force" "$@" && shift
62 test "$has_exec" && set x "$has_exec" "$@" && shift
64 exec git-send-pack "$@"