git-add.shon commit Improve "git add" again. (caf4f58)
   1#!/bin/sh
   2
   3show_only=
   4verbose=
   5while : ; do
   6  case "$1" in
   7    -n)
   8        show_only=true
   9        ;;
  10    -v)
  11        verbose=--verbose
  12        ;;
  13    *)
  14        break
  15        ;;
  16  esac
  17  shift
  18done
  19
  20GIT_DIR=$(git-rev-parse --git-dir) || exit
  21
  22if test -f "$GIT_DIR/info/exclude"
  23then
  24        git-ls-files -z \
  25        --exclude-from="$GIT_DIR/info/exclude" \
  26        --others --exclude-per-directory=.gitignore "$@"
  27else
  28        git-ls-files -z \
  29        --others --exclude-per-directory=.gitignore "$@"
  30fi |
  31case "$show_only" in
  32true)
  33        xargs -0 echo ;;
  34*)
  35        git-update-index --add $verbose -z --stdin ;;
  36esac