1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 08:47:56 +01:00
git/git-add.sh
Carl Worth 60ace8790f git-add: Add support for --, documentation, and test.
This adds support to git-add to allow the common -- to separate
command-line options and file names. It adds documentation and a new
git-add test case as well.

[jc: this should apply to 1.2.X maintenance series, so I reworked
 git-ls-files --error-unmatch test. ]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21 17:33:43 -08:00

45 lines
604 B
Bash
Executable file

#!/bin/sh
USAGE='[-n] [-v] <file>...'
SUBDIRECTORY_OK='Yes'
. git-sh-setup
show_only=
verbose=
while : ; do
case "$1" in
-n)
show_only=true
;;
-v)
verbose=--verbose
;;
--)
shift
break
;;
-*)
usage
;;
*)
break
;;
esac
shift
done
if test -f "$GIT_DIR/info/exclude"
then
git-ls-files -z \
--exclude-from="$GIT_DIR/info/exclude" \
--others --exclude-per-directory=.gitignore -- "$@"
else
git-ls-files -z \
--others --exclude-per-directory=.gitignore -- "$@"
fi |
case "$show_only" in
true)
xargs -0 echo ;;
*)
git-update-index --add $verbose -z --stdin ;;
esac