Documentation: not learning core git commands.
[git/git-svn.git] / git-add.sh
blobfdec86d1a41af847f9d737a2c058e2d2027f32fe
1 #!/bin/sh
3 die () {
4 echo >&2 "$*"
5 exit 1
8 usage() {
9 die "usage: git add [-n] [-v] <file>..."
12 show_only=
13 verbose=
14 while : ; do
15 case "$1" in
16 -n)
17 show_only=true
19 -v)
20 verbose=--verbose
22 -*)
23 usage
26 break
28 esac
29 shift
30 done
32 GIT_DIR=$(git-rev-parse --git-dir) || exit
34 if test -f "$GIT_DIR/info/exclude"
35 then
36 git-ls-files -z \
37 --exclude-from="$GIT_DIR/info/exclude" \
38 --others --exclude-per-directory=.gitignore -- "$@"
39 else
40 git-ls-files -z \
41 --others --exclude-per-directory=.gitignore -- "$@"
42 fi |
43 case "$show_only" in
44 true)
45 xargs -0 echo ;;
47 git-update-index --add $verbose -z --stdin ;;
48 esac