git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add two grep config options
@ 2011-03-25 21:21 Joe Ratterman
  2011-03-25 23:25 ` Junio C Hamano
  0 siblings, 1 reply; 19+ messages in thread
From: Joe Ratterman @ 2011-03-25 21:21 UTC (permalink / raw)
  To: gitster, git; +Cc: Joe Ratterman

grep.extended-regexp: Enabling this boolean option has the same effect
as adding "-E" to all "git grep " instantiations.  This can be
disabled by specifying "--no-extended-regexp" on a particular call.

grep.line-numbers: Enabling this boolean option has the same effect as
adding "-n" to all "git grep " instantiations.

Signed-off-by: Joe Ratterman <jratt0@gmail.com>
---
 Documentation/config.txt   |    6 ++++++
 Documentation/git-grep.txt |    9 +++++++++
 builtin/grep.c             |   10 ++++++++++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index c5e1835..6b084a8 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1101,6 +1101,12 @@ All gitcvs variables except for 'gitcvs.usecrlfattr' and
 is one of "ext" and "pserver") to make them apply only for the given
 access method.
 
+grep.line-numbers::
+	If set to true, enable '-n' option by default.
+
+grep.extended-regexp::
+	If set to true, enable '--extended-regexp' option by default.
+
 gui.commitmsgwidth::
 	Defines how wide the commit message window is in the
 	linkgit:git-gui[1]. "75" is the default.
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index dab0a78..71668e0 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -31,6 +31,15 @@ Look for specified patterns in the tracked files in the work tree, blobs
 registered in the index file, or blobs in given tree objects.
 
 
+CONFIGURATION
+-------------
+
+grep.line-numbers::
+	If set to true, enable '-n' option by default.
+
+grep.extended-regexp::
+	If set to true, enable '--extended-regexp' option by default.
+
 OPTIONS
 -------
 --cached::
diff --git a/builtin/grep.c b/builtin/grep.c
index fdf7131..fed9f65 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -303,6 +303,16 @@ static int grep_config(const char *var, const char *value, void *cb)
 	default: return 0;
 	}
 
+	if (!strcmp(var, "grep.extended-regexp")) {
+		opt->regflags = git_config_bool(var, value);
+		return 0;
+	}
+
+	if (!strcmp(var, "grep.line-numbers")) {
+		opt->linenum = git_config_bool(var, value);
+		return 0;
+	}
+
 	if (!strcmp(var, "color.grep"))
 		opt->color = git_config_colorbool(var, value, -1);
 	else if (!strcmp(var, "color.grep.context"))
-- 
1.7.4.1.4.g0ea33

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-03-30 19:31 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-25 21:21 [PATCH] Add two grep config options Joe Ratterman
2011-03-25 23:25 ` Junio C Hamano
2011-03-28  7:24   ` Michael J Gruber
2011-03-28 11:54     ` Jeff King
2011-03-28 12:00       ` Michael J Gruber
2011-03-28 12:09         ` Jeff King
2011-03-28 17:12       ` Junio C Hamano
2011-03-28 17:21         ` Jeff King
2011-03-28 18:39           ` Junio C Hamano
2011-03-28 18:08         ` Joe Ratterman
2011-03-28 12:13     ` Bert Wesarg
2011-03-28 14:48       ` Joe Ratterman
2011-03-28 17:14         ` Junio C Hamano
2011-03-28 22:12   ` [PATCH] grep: allow -E and -n to be turned on by default via configuration Junio C Hamano
2011-03-28 22:14     ` Junio C Hamano
2011-03-28 22:41     ` Joe Ratterman
2011-03-28 23:16       ` Junio C Hamano
2011-03-29  3:12     ` Joe Ratterman
2011-03-30 19:31       ` [PATCH v3] " Joe Ratterman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).