1#!/bin/sh23USAGE='[-n] [-v] <file>...'4SUBDIRECTORY_OK='Yes'5. git-sh-setup67show_only=8verbose=9while : ; do10case "$1" in11-n)12show_only=true13;;14-v)15verbose=--verbose16;;17--)18shift19break20;;21-*)22usage23;;24*)25break26;;27esac28shift29done3031# Check misspelled pathspec32case "$#" in330) ;;34*)35git-ls-files --error-unmatch --others --cached -- "$@" >/dev/null || {36echo >&2 "Maybe you misspelled it?"37exit 138}39;;40esac4142if test -f "$GIT_DIR/info/exclude"43then44git-ls-files -z \45--exclude-from="$GIT_DIR/info/exclude" \46--others --exclude-per-directory=.gitignore -- "$@"47else48git-ls-files -z \49--others --exclude-per-directory=.gitignore -- "$@"50fi |51case "$show_only" in52true)53xargs -0 echo ;;54*)55git-update-index --add $verbose -z --stdin ;;56esac