grep: make it clear i-t-a entries are ignored
[gitweb.git] / builtin / grep.c
index fe7b9fdd93c78c302f5be32e51c59a31a87412fb..f50817974070c414cc7c368df5bd78361a8f522d 100644 (file)
@@ -20,7 +20,7 @@
 #include "pathspec.h"
 
 static char const * const grep_usage[] = {
-       N_("git grep [options] [-e] <pattern> [<rev>...] [[--] <path>...]"),
+       N_("git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]"),
        NULL
 };
 
@@ -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;
@@ -738,7 +738,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                        PARSE_OPT_OPTARG, NULL, (intptr_t)default_pager },
                OPT_BOOL(0, "ext-grep", &external_grep_allowed__ignored,
                         N_("allow calling of grep(1) (ignored by this build)")),
-               { OPTION_CALLBACK, 0, "help-all", &options, NULL, N_("show usage"),
+               { OPTION_CALLBACK, 0, "help-all", NULL, NULL, N_("show usage"),
                  PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, help_callback },
                OPT_END()
        };