Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git-add.sh - git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fdec86d1a41af847f9d737a2c058e2d2027f32fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

die () {
    echo >&2 "$*"
    exit 1
}

usage() {
    die "usage: git add [-n] [-v] <file>..."
}

show_only=
verbose=
while : ; do
  case "$1" in
    -n)
	show_only=true
	;;
    -v)
	verbose=--verbose
	;;
    -*)
	usage
	;;
    *)
	break
	;;
  esac
  shift
done

GIT_DIR=$(git-rev-parse --git-dir) || exit

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