builtin/remote.c: rearrange xcalloc arguments
[gitweb.git] / grep.c
diff --git a/grep.c b/grep.c
index f5101f7218962f026aff7dd2d891cf7bc010a9ea..4aef0a69d084deee61486e43bc62ae2da6b6b440 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -1562,8 +1562,11 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
         */
        if (opt->count && count) {
                char buf[32];
-               output_color(opt, gs->name, strlen(gs->name), opt->color_filename);
-               output_sep(opt, ':');
+               if (opt->pathname) {
+                       output_color(opt, gs->name, strlen(gs->name),
+                                    opt->color_filename);
+                       output_sep(opt, ':');
+               }
                snprintf(buf, sizeof(buf), "%u\n", count);
                opt->output(opt, buf, strlen(buf));
                return 1;