summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b77029)
raw | patch | inline | side by side (parent: 2b77029)
author | Junio C Hamano <gitster@pobox.com> | |
Tue, 12 Jan 2010 08:22:23 +0000 (00:22 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 12 Jan 2010 08:47:02 +0000 (00:47 -0800) |
The -L (--files-without-match) option is supposed to show paths that
produced no matches. When running the internal grep on work tree files,
however, we had an optimization to just return on zero-sized files,
without doing anything.
This optimization doesn't matter too much in practice (a tracked empty
file must be rare, or there is something wrong with your project); to
produce results consistent with GNU grep, we should stop the optimization
and show empty files as not having the given pattern.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
produced no matches. When running the internal grep on work tree files,
however, we had an optimization to just return on zero-sized files,
without doing anything.
This optimization doesn't matter too much in practice (a tracked empty
file must be rare, or there is something wrong with your project); to
produce results consistent with GNU grep, we should stop the optimization
and show empty files as not having the given pattern.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-grep.c | patch | blob | history |
diff --git a/builtin-grep.c b/builtin-grep.c
index a5b6719a1af014497399ea6ff4f1a6f3852a0570..af6c6fe8a7ed677de84cdbd828e8daae0a6bb12d 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
error("'%s': %s", filename, strerror(errno));
return 0;
}
- if (!st.st_size)
- return 0; /* empty file -- no grep hit */
if (!S_ISREG(st.st_mode))
return 0;
sz = xsize_t(st.st_size);