Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-06-13 22:21:44 +0400
committerJunio C Hamano <gitster@pobox.com>2010-06-13 22:21:44 +0400
commit534930807c230436a2b3f4891df810af0b8c0353 (patch)
treed21e362adb883fd87159388535655be0da059e7c /builtin
parenta26df4cd2fdad7451d4ec99f8a339b9e107a4728 (diff)
parented40a0951cedb70777669144478166aa5bb2cf9c (diff)
Merge branch 'rs/grep-binary'
* rs/grep-binary: grep: support NUL chars in search strings for -F grep: use REG_STARTEND for all matching if available grep: continue case insensitive fixed string search after NUL chars grep: use memmem() for fixed string search grep: --name-only over binary grep: --count over binary grep: grep: refactor handling of binary mode options grep: add test script for binary file handling
Diffstat (limited to 'builtin')
-rw-r--r--builtin/grep.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index b194ea3cea..d0a73da07a 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -724,11 +724,15 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
if (!patterns)
die_errno("cannot open '%s'", arg);
while (strbuf_getline(&sb, patterns, '\n') == 0) {
+ char *s;
+ size_t len;
+
/* ignore empty line like grep does */
if (sb.len == 0)
continue;
- append_grep_pattern(grep_opt, strbuf_detach(&sb, NULL), arg,
- ++lno, GREP_PATTERN);
+
+ s = strbuf_detach(&sb, &len);
+ append_grep_pat(grep_opt, s, len, arg, ++lno, GREP_PATTERN);
}
fclose(patterns);
strbuf_release(&sb);