grep: make it clear i-t-a entries are ignored
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sun, 27 Dec 2015 01:51:32 +0000 (08:51 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Dec 2015 20:42:35 +0000 (12:42 -0800)
The expression "!S_ISREG(ce)" covers i-t-a entries as well because
ce->ce_mode would be zero then. I could make a comment saying that, but
it's probably better just to comment with code, in case i-t-a entry
content changes in future.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c
index d04f4400d9db8ef9f0b0dde0c8be46a11bd0e2f7..f50817974070c414cc7c368df5bd78361a8f522d 100644 (file)
@@ -375,7 +375,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))
+               if (!S_ISREG(ce->ce_mode) || ce_intent_to_add(ce))
                        continue;
                if (!ce_path_match(ce, pathspec, NULL))
                        continue;