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-*)
18usage
19;;
20*)
21break
22;;
23esac
24shift
25done
2627
# Check misspelled pathspec
28case "$#" in
290) ;;
30*)
31git-ls-files --error-unmatch --others --cached -- "$@" >/dev/null || {
32echo >&2 "Maybe you misspelled it?"
33exit 1
34}
35;;
36esac
3738
if test -f "$GIT_DIR/info/exclude"
39then
40git-ls-files -z \
41--exclude-from="$GIT_DIR/info/exclude" \
42--others --exclude-per-directory=.gitignore -- "$@"
43else
44git-ls-files -z \
45--others --exclude-per-directory=.gitignore -- "$@"
46fi |
47case "$show_only" in
48true)
49xargs -0 echo ;;
50*)
51git-update-index --add $verbose -z --stdin ;;
52esac