Deprecate usage of git-var -l for getting config vars list
[git/debian.git] / git-push.sh
blobf10cadbf159bcd63af0c3834bd7cd2fab6cce57c
1 #!/bin/sh
3 USAGE='[--all] [--tags] [--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 has_thin=--thin
12 remote=
13 do_tags=
15 while case "$#" in 0) break ;; esac
17 case "$1" in
18 --all)
19 has_all=--all ;;
20 --tags)
21 do_tags=yes ;;
22 --force)
23 has_force=--force ;;
24 --exec=*)
25 has_exec="$1" ;;
26 --thin)
27 ;; # noop
28 --no-thin)
29 has_thin= ;;
30 -*)
31 usage ;;
33 set x "$@"
34 shift
35 break ;;
36 esac
37 shift
38 done
39 case "$#" in
41 echo "Where would you want to push today?"
42 usage ;;
43 esac
45 . git-parse-remote
46 remote=$(get_remote_url "$@")
48 case "$has_all" in
49 --all)
50 set x ;;
51 '')
52 case "$do_tags,$#" in
53 yes,1)
54 set x $(cd "$GIT_DIR/refs" && find tags -type f -print) ;;
55 yes,*)
56 set x $(cd "$GIT_DIR/refs" && find tags -type f -print) \
57 $(get_remote_refs_for_push "$@") ;;
58 ,*)
59 set x $(get_remote_refs_for_push "$@") ;;
60 esac
61 esac
63 shift ;# away the initial 'x'
65 # $# is now 0 if there was no explicit refspec on the command line
66 # and there was no defalt refspec to push from remotes/ file.
67 # we will let git-send-pack to do its "matching refs" thing.
69 case "$remote" in
70 git://*)
71 die "Cannot use READ-ONLY transport to push to $remote" ;;
72 rsync://*)
73 die "Pushing with rsync transport is deprecated" ;;
74 esac
76 set x "$remote" "$@"; shift
77 test "$has_all" && set x "$has_all" "$@" && shift
78 test "$has_force" && set x "$has_force" "$@" && shift
79 test "$has_exec" && set x "$has_exec" "$@" && shift
80 test "$has_thin" && set x "$has_thin" "$@" && shift
82 case "$remote" in
83 http://* | https://*)
84 exec git-http-push "$@";;
86 exec git-send-pack "$@";;
87 esac