summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 30d00c3)
raw | patch | inline | side by side (parent: 30d00c3)
author | Johannes Schindelin <johannes.schindelin@gmx.de> | |
Sat, 12 Jun 2010 16:32:11 +0000 (11:32 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 13 Jun 2010 16:15:11 +0000 (09:15 -0700) |
There were three awfully similar code paths ending the threaded grep. It
is better to avoid duplicated code, though.
This change might very well prevent a race, where the grep patterns were
free()d before waiting that all threads finished.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
is better to avoid duplicated code, though.
This change might very well prevent a race, where the grep patterns were
free()d before waiting that all threads finished.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
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 5b8879f7b3d5440f18734ad03b196a6238964ec2..211121289049d9e3d6422b4a0dfc43146850b0b2 100644 (file)
--- a/builtin/grep.c
+++ b/builtin/grep.c
if (hit && opt->status_only)
break;
}
- free_grep_patterns(opt);
return hit;
}
if (hit && opt->status_only)
break;
}
- free_grep_patterns(opt);
return hit;
}
}
if (!use_index) {
- int hit;
if (cached)
die("--cached cannot be used with --no-index.");
if (list.nr)
die("--no-index cannot be used with revs.");
hit = grep_directory(&opt, paths);
- if (use_threads)
- hit |= wait_all();
- return !hit;
- }
-
- if (!list.nr) {
- int hit;
+ } else if (!list.nr) {
if (!cached)
setup_work_tree();
hit = grep_cache(&opt, paths, cached);
- if (use_threads)
- hit |= wait_all();
- return !hit;
+ } else {
+ if (cached)
+ die("both --cached and trees are given.");
+ hit = grep_objects(&opt, paths, &list);
}
- if (cached)
- die("both --cached and trees are given.");
- hit = grep_objects(&opt, paths, &list);
-
if (use_threads)
hit |= wait_all();
free_grep_patterns(&opt);