projects
/
git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Allow finding things that begin with a dash in 'git grep'
[git]
/
git-grep.sh
1
#!/bin/sh
2
flags=
3
while :; do
4
pattern="$1"
5
case "$pattern" in
6
-i|-I|-a|-E|-H|-h|-l)
7
flags="$flags $pattern"
8
shift
9
;;
10
-e)
11
pattern="$2"
12
shift
13
break
14
;;
15
-*)
16
echo "unknown flag $pattern" >&2
17
exit 1
18
;;
19
*)
20
break
21
;;
22
esac
23
done
24
shift
25
git-ls-files -z "$@" | xargs -0 grep $flags -e "$pattern"