git-push.shon commit Optionally do not list empty directories in git-ls-files --others (b0a3de4)
   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=
  12remote=
  13do_tags=
  14
  15while case "$#" in 0) break ;; esac
  16do
  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                has_thin="$1" ;;
  28        -*)
  29                usage ;;
  30        *)
  31                set x "$@"
  32                shift
  33                break ;;
  34        esac
  35        shift
  36done
  37case "$#" in
  380)
  39        echo "Where would you want to push today?"
  40        usage ;;
  41esac
  42
  43. git-parse-remote
  44remote=$(get_remote_url "$@")
  45
  46case "$has_all" in
  47--all)
  48        set x ;;
  49'')
  50        case "$do_tags,$#" in
  51        yes,1)
  52                set x $(cd "$GIT_DIR/refs" && find tags -type f -print) ;;
  53        yes,*)
  54                set x $(cd "$GIT_DIR/refs" && find tags -type f -print) \
  55                    $(get_remote_refs_for_push "$@") ;;
  56        ,*)
  57                set x $(get_remote_refs_for_push "$@") ;;
  58        esac
  59esac
  60
  61shift ;# away the initial 'x'
  62
  63# $# is now 0 if there was no explicit refspec on the command line
  64# and there was no defalt refspec to push from remotes/ file.
  65# we will let git-send-pack to do its "matching refs" thing.
  66
  67case "$remote" in
  68git://*)
  69        die "Cannot use READ-ONLY transport to push to $remote" ;;
  70rsync://*)
  71        die "Pushing with rsync transport is deprecated" ;;
  72esac
  73
  74set x "$remote" "$@"; shift
  75test "$has_all" && set x "$has_all" "$@" && shift
  76test "$has_force" && set x "$has_force" "$@" && shift
  77test "$has_exec" && set x "$has_exec" "$@" && shift
  78test "$has_thin" && set x "$has_thin" "$@" && shift
  79
  80case "$remote" in
  81http://* | https://*)
  82        exec git-http-push "$@";;
  83*)
  84        exec git-send-pack "$@";;
  85esac