git-fetch: follow tag only when tracking remote branch.
[git.git] / git-add.sh
blob611f152daca6fd4ca7a9eab57a9294a26a7924ae
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 shift
19 break
21 -*)
22 usage
25 break
27 esac
28 shift
29 done
31 if test -f "$GIT_DIR/info/exclude"
32 then
33 git-ls-files -z \
34 --exclude-from="$GIT_DIR/info/exclude" \
35 --others --exclude-per-directory=.gitignore -- "$@"
36 else
37 git-ls-files -z \
38 --others --exclude-per-directory=.gitignore -- "$@"
39 fi |
40 case "$show_only" in
41 true)
42 xargs -0 echo ;;
44 git-update-index --add $verbose -z --stdin ;;
45 esac