1#!/bin/sh 2 3USAGE='[--all] [--tags] [--force] <repository> [<refspec>...]' 4. git-sh-setup 5 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= 11has_thin=--thin 12remote= 13do_tags= 14 15while case"$#"in0)break;;esac 16do 17case"$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 ;; 32*) 33set x "$@" 34shift 35break;; 36esac 37shift 38done 39case"$#"in 400) 41echo"Where would you want to push today?" 42 usage ;; 43esac 44 45. git-parse-remote 46remote=$(get_remote_url "$@") 47 48case"$has_all"in 49--all) 50set x ;; 51'') 52case"$do_tags,$#"in 53yes,1) 54set x $(cd "$GIT_DIR/refs" && find tags -type f -print);; 55yes,*) 56set x $(cd "$GIT_DIR/refs" && find tags -type f -print) \ 57$(get_remote_refs_for_push "$@");; 58,*) 59set x $(get_remote_refs_for_push "$@");; 60esac 61esac 62 63shift;# away the initial 'x' 64 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. 68 69case"$remote"in 70git://*) 71 die "Cannot use READ-ONLY transport to push to$remote";; 72rsync://*) 73 die "Pushing with rsync transport is deprecated";; 74esac 75 76set x "$remote""$@";shift 77test"$has_all"&&set x "$has_all""$@"&&shift 78test"$has_force"&&set x "$has_force""$@"&&shift 79test"$has_exec"&&set x "$has_exec""$@"&&shift 80test"$has_thin"&&set x "$has_thin""$@"&&shift 81 82case"$remote"in 83http://* | https://*) 84exec git-http-push"$@";; 85*) 86exec git-send-pack"$@";; 87esac