grep: add grep.fullName config variable
authorAndreas Schwab <schwab@linux-m68k.org>
Mon, 17 Mar 2014 19:16:05 +0000 (20:16 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Mar 2014 19:38:00 +0000 (12:38 -0700)
This configuration variable sets the default for the --full-name option.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-grep.txt
grep.c
index f83733490f5a881f6f197b3b62000337c500ef9d..31811f16bdaac49d01d38dcdea82bb191942b1cf 100644 (file)
@@ -53,6 +53,9 @@ grep.extendedRegexp::
        option is ignored when the 'grep.patternType' option is set to a value
        other than 'default'.
 
+grep.fullName::
+       If set to true, enable '--full-name' option by default.
+
 
 OPTIONS
 -------
diff --git a/grep.c b/grep.c
index c668034739258d0cd1e7108357da80d44891221f..ece04bf2756ec6e2555a7569dacb8c66931eff7d 100644 (file)
--- 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"))