]> git.ipfire.org Git - thirdparty/git.git/blob - git-add.sh
Merge http://www.kernel.org/pub/scm/gitk/gitk
[thirdparty/git.git] / git-add.sh
1 #!/bin/sh
2
3 show_only=
4 verbose=
5 while : ; do
6 case "$1" in
7 -n)
8 show_only=true
9 ;;
10 -v)
11 verbose=--verbose
12 ;;
13 *)
14 break
15 ;;
16 esac
17 shift
18 done
19
20 GIT_DIR=$(git-rev-parse --git-dir) || exit
21
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 ;;
34 *)
35 git-update-index --add $verbose -z --stdin ;;
36 esac