git-add.shon commit Elaborate on why ':' is a bad idea in a ref name. (87a56cd)
   1#!/bin/sh
   2
   3USAGE='[-n] [-v] <file>...'
   4SUBDIRECTORY_OK='Yes'
   5. git-sh-setup
   6
   7show_only=
   8verbose=
   9while : ; do
  10  case "$1" in
  11    -n)
  12        show_only=true
  13        ;;
  14    -v)
  15        verbose=--verbose
  16        ;;
  17    --)
  18        shift
  19        break
  20        ;;
  21    -*)
  22        usage
  23        ;;
  24    *)
  25        break
  26        ;;
  27  esac
  28  shift
  29done
  30
  31# Check misspelled pathspec
  32case "$#" in
  330)      ;;
  34*)
  35        git-ls-files --error-unmatch --others --cached -- "$@" >/dev/null || {
  36                echo >&2 "Maybe you misspelled it?"
  37                exit 1
  38        }
  39        ;;
  40esac
  41
  42if test -f "$GIT_DIR/info/exclude"
  43then
  44        git-ls-files -z \
  45        --exclude-from="$GIT_DIR/info/exclude" \
  46        --others --exclude-per-directory=.gitignore -- "$@"
  47else
  48        git-ls-files -z \
  49        --others --exclude-per-directory=.gitignore -- "$@"
  50fi |
  51case "$show_only" in
  52true)
  53        xargs -0 echo ;;
  54*)
  55        git-update-index --add $verbose -z --stdin ;;
  56esac