]> git.ipfire.org Git - thirdparty/git.git/blob - git-add.sh
[PATCH] Initial AIX portability fixes.
[thirdparty/git.git] / git-add.sh
1 #!/bin/sh
2
3 die () {
4 echo >&2 "$*"
5 exit 1
6 }
7
8 usage() {
9 die "usage: git add [-n] [-v] <file>..."
10 }
11
12 show_only=
13 verbose=
14 while : ; do
15 case "$1" in
16 -n)
17 show_only=true
18 ;;
19 -v)
20 verbose=--verbose
21 ;;
22 -*)
23 usage
24 ;;
25 *)
26 break
27 ;;
28 esac
29 shift
30 done
31
32 GIT_DIR=$(git-rev-parse --git-dir) || exit
33
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 ;;
46 *)
47 git-update-index --add $verbose -z --stdin ;;
48 esac