Fixes for ancient versions of GNU make
[git.git] / git-add.sh
blob13fad820d4758a041222a9285719245f6c8bac18
1 #!/bin/sh
3 USAGE='[-n] [-v] <file>...'
4 SUBDIRECTORY_OK='Yes'
5 . git-sh-setup
7 show_only=
8 verbose=
9 while : ; do
10 case "$1" in
11 -n)
12 show_only=true
14 -v)
15 verbose=--verbose
17 -*)
18 usage
21 break
23 esac
24 shift
25 done
27 # Check misspelled pathspec
28 case "$#" in
29 0) ;;
31 git-ls-files --error-unmatch --others --cached -- "$@" >/dev/null || {
32 echo >&2 "Maybe you misspelled it?"
33 exit 1
36 esac
38 if test -f "$GIT_DIR/info/exclude"
39 then
40 git-ls-files -z \
41 --exclude-from="$GIT_DIR/info/exclude" \
42 --others --exclude-per-directory=.gitignore -- "$@"
43 else
44 git-ls-files -z \
45 --others --exclude-per-directory=.gitignore -- "$@"
46 fi |
47 case "$show_only" in
48 true)
49 xargs -0 echo ;;
51 git-update-index --add $verbose -z --stdin ;;
52 esac