Do not require ls-remote to be run inside a git repository.
[alt-git.git] / git-add.sh
blob3d364db2517b6a19de6b8e26f6d61a86589c1fcc
1 #!/bin/sh
3 show_only=
4 verbose=
5 while : ; do
6 case "$1" in
7 -n)
8 show_only=true
9 verbose=true
11 -v)
12 verbose=true
15 break
17 esac
18 shift
19 done
21 GIT_DIR=$(git-rev-parse --git-dir) || exit
22 global_exclude=
23 if [ -f "$GIT_DIR/info/exclude" ]; then
24 global_exclude="--exclude-from=$GIT_DIR/info/exclude"
26 for i in $(git-ls-files --others \
27 $global_exclude --exclude-per-directory=.gitignore \
28 "$@")
30 [ "$verbose" ] && echo " $i"
31 [ "$show_only" ] || git-update-index --add -- "$i" || exit
32 done