summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2011-12-12 22:16:06 +0100
committerJunio C Hamano <gitster@pobox.com>2011-12-12 15:45:42 -0800
commitb8ffedca6f9e1043956ba611ae52bea449779456 (patch)
tree51725ec80c72f114e83e40091b5dc36f4737cf8e /grep.c
parent9859a023fef30ffebdd22ad9639c587ac720b8b6 (diff)
downloadgit-b8ffedca6f9e1043956ba611ae52bea449779456.tar.gz
grep: load funcname patterns for -W
git-grep avoids loading the funcname patterns unless they are needed. ba8ea74 (grep: add option to show whole function as context, 2011-08-01) forgot to extend this test also to the new funcbody feature. Do so. The catch is that we also have to disable threading when using userdiff, as explained in grep_threads_ok(). So we must be careful to introduce the same test there. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/grep.c b/grep.c
index b29d09c7f6..7a070e97c4 100644
--- a/grep.c
+++ b/grep.c
@@ -948,8 +948,8 @@ int grep_threads_ok(const struct grep_opt *opt)
* machinery in grep_buffer_1. The attribute code is not
* thread safe, so we disable the use of threads.
*/
- if (opt->funcname && !opt->unmatch_name_only && !opt->status_only &&
- !opt->name_only)
+ if ((opt->funcname || opt->funcbody)
+ && !opt->unmatch_name_only && !opt->status_only && !opt->name_only)
return 0;
return 1;
@@ -1008,7 +1008,8 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name,
}
memset(&xecfg, 0, sizeof(xecfg));
- if (opt->funcname && !opt->unmatch_name_only && !opt->status_only &&
+ if ((opt->funcname || opt->funcbody)
+ && !opt->unmatch_name_only && !opt->status_only &&
!opt->name_only && !binary_match_only && !collect_hits) {
struct userdiff_driver *drv = userdiff_find_by_path(name);
if (drv && drv->funcname.pattern) {