git-add.shon commit Bugfix: stop if directory already exists (b0c698a)
   1#!/bin/sh
   2
   3usage() {
   4    die "usage: git add [-n] [-v] <file>..."
   5}
   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        usage
  19        ;;
  20    *)
  21        break
  22        ;;
  23  esac
  24  shift
  25done
  26
  27GIT_DIR=$(git-rev-parse --git-dir) || exit
  28
  29if test -f "$GIT_DIR/info/exclude"
  30then
  31        git-ls-files -z \
  32        --exclude-from="$GIT_DIR/info/exclude" \
  33        --others --exclude-per-directory=.gitignore -- "$@"
  34else
  35        git-ls-files -z \
  36        --others --exclude-per-directory=.gitignore -- "$@"
  37fi |
  38case "$show_only" in
  39true)
  40        xargs -0 echo ;;
  41*)
  42        git-update-index --add $verbose -z --stdin ;;
  43esac