git-push-scripton commit Replace unsetenv() and setenv() with older putenv(). (e72a7d4)
   1#!/bin/sh
   2. git-sh-setup-script || die "Not a git archive"
   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        *)
  23                remote="$1"
  24                shift
  25                set x "$@"
  26                shift
  27                break ;;
  28        esac
  29        shift
  30done
  31
  32case "$remote" in
  33*:* | /* | ../* | ./* )
  34        # An URL, host:/path/to/git, absolute and relative paths.
  35        ;;
  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=
  46        fi
  47        remote=$(sed -e 's/#.*//' "$GIT_DIR/branches/$remote") &&
  48        expr "$remote" : '..*:' >/dev/null &&
  49        remote="$remote$remainder" ||
  50        die "Cannot parse remote $remote"
  51        ;;
  52esac
  53
  54case "$remote" in
  55http://* | https://* | git://* | rsync://* )
  56        die "Cannot push to $remote" ;;
  57esac
  58
  59set x "$remote" "$@"; shift
  60test "$has_all" && set x "$has_all" "$@" && shift
  61test "$has_force" && set x "$has_force" "$@" && shift
  62test "$has_exec" && set x "$has_exec" "$@" && shift
  63
  64exec git-send-pack "$@"