projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sha1_to_hex: properly terminate the SHA1
[git.git]
/
git-grep.sh
diff --git
a/git-grep.sh
b/git-grep.sh
index
51924fd
..
2ed8e95
100755
(executable)
--- a/
git-grep.sh
+++ b/
git-grep.sh
@@
-3,6
+3,10
@@
# Copyright (c) Linus Torvalds, 2005
#
# Copyright (c) Linus Torvalds, 2005
#
+USAGE='<option>... <pattern> <path>...'
+SUBDIRECTORY_OK='Yes'
+. git-sh-setup
+
pattern=
flags=()
git_flags=()
pattern=
flags=()
git_flags=()
@@
-39,5
+43,8
@@
while : ; do
esac
shift
done
esac
shift
done
+[ "$pattern" ] || {
+ usage
+}
git-ls-files -z "${git_flags[@]}" "$@" |
git-ls-files -z "${git_flags[@]}" "$@" |
- xargs -0 grep "${flags[@]}" "$pattern"
+ xargs -0 grep "${flags[@]}"
-e
"$pattern"