summaryrefslogtreecommitdiff
path: root/git-grep.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2005-12-14 13:01:01 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2005-12-14 13:01:01 -0800
commitb0d3e9baaa16c805ef941e8f26d55fb23f091ef5 (patch)
tree142e8fb76c906de7b61b9bf55ab026bee2388aa3 /git-grep.sh
parentDocumentation: topic branches (diff)
parentapplypatch: no need to do non-portable [[ ... ]] (diff)
downloadtgif-b0d3e9baaa16c805ef941e8f26d55fb23f091ef5.tar.xz
Merge branch 'fk/usage'
Diffstat (limited to 'git-grep.sh')
-rwxr-xr-xgit-grep.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-grep.sh b/git-grep.sh
index 44c16130bd..2ed8e955d6 100755
--- a/git-grep.sh
+++ b/git-grep.sh
@@ -3,6 +3,10 @@
# Copyright (c) Linus Torvalds, 2005
#
+USAGE='<option>... <pattern> <path>...'
+SUBDIRECTORY_OK='Yes'
+. git-sh-setup
+
pattern=
flags=()
git_flags=()
@@ -40,8 +44,7 @@ while : ; do
shift
done
[ "$pattern" ] || {
- echo >&2 "usage: 'git grep <pattern> [pathspec*]'"
- exit 1
+ usage
}
git-ls-files -z "${git_flags[@]}" "$@" |
xargs -0 grep "${flags[@]}" -e "$pattern"