count-objects: report alternates via verbose mode
[gitweb.git] / builtin / grep.c
index 462e60790165a333d58d81ec65ae4ae6da8d4f79..8887b6addb5f9085dd9ed46a9e5ad81768c551cb 100644 (file)
@@ -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,9 +396,10 @@ 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);
+                       hit |= grep_sha1(opt, ce->oid.hash, ce->name, 0,
+                                        ce->name);
                }
                else
                        hit |= grep_file(opt, ce->name);