1#!/bin/sh
2
3show_only=
4verbose=
5while : ; do
6 case "$1" in
7 -n)
8 show_only=true
9 verbose=true
10 ;;
11 -v)
12 verbose=true
13 ;;
14 *)
15 break
16 ;;
17 esac
18 shift
19done
20
21GIT_DIR=$(git-rev-parse --git-dir) || exit
22global_exclude=
23if [ -f "$GIT_DIR/info/exclude" ]; then
24 global_exclude="--exclude-from=$GIT_DIR/info/exclude"
25fi
26for i in $(git-ls-files --others \
27 $global_exclude --exclude-per-directory=.gitignore \
28 "$@")
29do
30 [ "$verbose" ] && echo " $i"
31 [ "$show_only" ] || git-update-index --add -- "$i" || exit
32done