Skip to content

Commit 4d55200

Browse files
pcloudsgitster
authored andcommitted
grep: make it clear i-t-a entries are ignored
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 895ff3b commit 4d55200

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/grep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
375375

376376
for (nr = 0; nr < active_nr; nr++) {
377377
const struct cache_entry *ce = active_cache[nr];
378-
if (!S_ISREG(ce->ce_mode))
378+
if (!S_ISREG(ce->ce_mode) || ce_intent_to_add(ce))
379379
continue;
380380
if (!ce_path_match(ce, pathspec, NULL))
381381
continue;

0 commit comments

Comments
 (0)