]>
Commit | Line | Data |
---|---|---|
215a7ad1 | 1 | #!/bin/sh |
37539fbd | 2 | |
806f36d4 FK |
3 | USAGE='[-n] [-v] <file>...' |
4 | SUBDIRECTORY_OK='Yes' | |
5 | . git-sh-setup | |
918db541 | 6 | |
37539fbd LT |
7 | show_only= |
8 | verbose= | |
9 | while : ; do | |
10 | case "$1" in | |
11 | -n) | |
12 | show_only=true | |
37539fbd LT |
13 | ;; |
14 | -v) | |
caf4f582 | 15 | verbose=--verbose |
37539fbd | 16 | ;; |
60ace879 CW |
17 | --) |
18 | shift | |
19 | break | |
20 | ;; | |
918db541 CS |
21 | -*) |
22 | usage | |
23 | ;; | |
37539fbd LT |
24 | *) |
25 | break | |
26 | ;; | |
27 | esac | |
28 | shift | |
29 | done | |
30 | ||
45e48120 JH |
31 | # Check misspelled pathspec |
32 | case "$#" in | |
33 | 0) ;; | |
34 | *) | |
35 | git-ls-files --error-unmatch --others --cached -- "$@" >/dev/null || { | |
36 | echo >&2 "Maybe you misspelled it?" | |
37 | exit 1 | |
38 | } | |
39 | ;; | |
40 | esac | |
41 | ||
caf4f582 JH |
42 | if test -f "$GIT_DIR/info/exclude" |
43 | then | |
44 | git-ls-files -z \ | |
45 | --exclude-from="$GIT_DIR/info/exclude" \ | |
4bfe1199 | 46 | --others --exclude-per-directory=.gitignore -- "$@" |
caf4f582 JH |
47 | else |
48 | git-ls-files -z \ | |
4bfe1199 | 49 | --others --exclude-per-directory=.gitignore -- "$@" |
caf4f582 JH |
50 | fi | |
51 | case "$show_only" in | |
52 | true) | |
53 | xargs -0 echo ;; | |
54 | *) | |
55 | git-update-index --add $verbose -z --stdin ;; | |
56 | esac |