summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/grep.c b/grep.c
index c668034739..99217dc04f 100644
--- a/grep.c
+++ b/grep.c
@@ -86,6 +86,11 @@ int grep_config(const char *var, const char *value, void *cb)
return 0;
}
+ if (!strcmp(var, "grep.fullname")) {
+ opt->relative = !git_config_bool(var, value);
+ return 0;
+ }
+
if (!strcmp(var, "color.grep"))
opt->color = git_config_colorbool(var, value);
else if (!strcmp(var, "color.grep.context"))
@@ -1562,8 +1567,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;
@@ -1650,7 +1658,7 @@ void grep_source_init(struct grep_source *gs, enum grep_source_type type,
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;