Teach git-add and git-commit to handle filenames starting with '-'.
[git/trast.git] / git-add.sh
blob4bf41281d5554f9b1da103b0360eebc411a435eb
1 #!/bin/sh
3 show_only=
4 verbose=
5 while : ; do
6 case "$1" in
7 -n)
8 show_only=true
9 ;;
10 -v)
11 verbose=--verbose
14 break
16 esac
17 shift
18 done
20 GIT_DIR=$(git-rev-parse --git-dir) || exit
22 if test -f "$GIT_DIR/info/exclude"
23 then
24 git-ls-files -z \
25 --exclude-from="$GIT_DIR/info/exclude" \
26 --others --exclude-per-directory=.gitignore -- "$@"
27 else
28 git-ls-files -z \
29 --others --exclude-per-directory=.gitignore -- "$@"
30 fi |
31 case "$show_only" in
32 true)
33 xargs -0 echo ;;
35 git-update-index --add $verbose -z --stdin ;;
36 esac