1#!/bin/sh
2
3USAGE='[-n] [-v] <file>...'
4SUBDIRECTORY_OK='Yes'
5. git-sh-setup
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
27if test -f "$GIT_DIR/info/exclude"
28then
29 git-ls-files -z \
30 --exclude-from="$GIT_DIR/info/exclude" \
31 --others --exclude-per-directory=.gitignore -- "$@"
32else
33 git-ls-files -z \
34 --others --exclude-per-directory=.gitignore -- "$@"
35fi |
36case "$show_only" in
37true)
38 xargs -0 echo ;;
39*)
40 git-update-index --add $verbose -z --stdin ;;
41esac