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