aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-07-13 11:24:17 -0700
committerJunio C Hamano <gitster@pobox.com>2016-07-13 11:24:18 -0700
commit42bd66816bd117ed5e6d15f38dbe9e655ebc76a5 (patch)
tree171137a5689f92dca06938be5842a567f7d164cf /builtin
parent5eb1e9f1a0df41cfc6a75cef9c2f11460a6da8dc (diff)
parentb8e47d1acfa299299d1120241bdc6164867d1289 (diff)
downloadgit-42bd66816bd117ed5e6d15f38dbe9e655ebc76a5.tar.gz
git-42bd66816bd117ed5e6d15f38dbe9e655ebc76a5.tar.xz
Merge branch 'nd/ita-cleanup'
Git does not know what the contents in the index should be for a path added with "git add -N" yet, so "git grep --cached" should not show hits (or show lack of hits, with -L) in such a path, but that logic does not apply to "git grep", i.e. searching in the working tree files. But we did so by mistake, which has been corrected. * nd/ita-cleanup: grep: fix grepping for "intent to add" files t7810-grep.sh: fix a whitespace inconsistency t7810-grep.sh: fix duplicated test name
Diffstat (limited to 'builtin')
-rw-r--r--builtin/grep.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 462e60790..ae738312a 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -386,7 +386,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
for (nr = 0; nr < active_nr; nr++) {
const struct cache_entry *ce = active_cache[nr];
- if (!S_ISREG(ce->ce_mode) || ce_intent_to_add(ce))
+ if (!S_ISREG(ce->ce_mode))
continue;
if (!ce_path_match(ce, pathspec, NULL))
continue;
@@ -396,7 +396,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
* cache version instead
*/
if (cached || (ce->ce_flags & CE_VALID) || ce_skip_worktree(ce)) {
- if (ce_stage(ce))
+ if (ce_stage(ce) || ce_intent_to_add(ce))
continue;
hit |= grep_sha1(opt, ce->sha1, ce->name, 0, ce->name);
}