3 # Copyright (c) Linus Torvalds, 2005
6 USAGE
='[<option>...] [-e] <pattern> [<path>...]'
11 if [ -z "$no_more_patterns" ]
13 pattern
="$1" no_more_patterns
=yes
15 die
"git-grep: do not specify more than one pattern"
25 -o|
--cached|
--deleted|
--others|
--killed|\
26 --ignored|
--modified|
--exclude=*|\
27 --exclude-from=*|\
--exclude-per-directory=*)
28 git_flags
=("${git_flags[@]}" "$1")
35 flags
=("${flags[@]}" "$1" "$2")
39 # The rest are git-ls-files paths
44 flags
=("${flags[@]}" "$1")
47 if [ -z "$no_more_patterns" ]
52 [ "$1" = -- ] && shift
61 git-ls-files
-z "${git_flags[@]}" -- "$@" |
62 xargs -0 grep "${flags[@]}" -e "$pattern" --