From: Junio C Hamano Date: Tue, 18 Mar 2014 20:51:20 +0000 (-0700) Subject: Merge branch 'rs/grep-h-c' X-Git-Tag: v2.0.0-rc0~85 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6f6be80ef15f09d7a5330a6cee03ab5fe3d12979?ds=inline;hp=-c Merge branch 'rs/grep-h-c' "git grep" learns to handle combination of "-h (no header)" and "-c (counts)". * rs/grep-h-c: grep: support -h (no header) with --count t7810: add missing variables to tests in loop --- 6f6be80ef15f09d7a5330a6cee03ab5fe3d12979 diff --combined grep.c index f5101f7218,94f7290eb7..4aef0a69d0 --- a/grep.c +++ b/grep.c @@@ -1562,8 -1562,11 +1562,11 @@@ static int grep_source_1(struct grep_op */ 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; @@@ -1650,7 -1653,7 +1653,7 @@@ void grep_source_init(struct grep_sourc break; case GREP_SOURCE_SHA1: gs->identifier = xmalloc(20); - memcpy(gs->identifier, identifier, 20); + hashcpy(gs->identifier, identifier); break; case GREP_SOURCE_BUF: gs->identifier = NULL;