contrib/git-jump: allow to configure the grep command
PATCH 1/1 contrib/git-jump: allow to configure the grep command
Add the configuration option "jump.grepCmd" that allows to configure the command that is used to search in grep mode. This allows the users of git-jump to use ag(1) or ack(1) as search engines.
--- contrib/git-jump/README | 3 +++ contrib/git-jump/git-jump | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
contrib/git-jump/README +3 -0
@@ -63,6 +63,9 @@ git jump grep foo_bar # same as above, but case-insensitive; you can give # arbitrary grep options git jump grep -i foo_bar + +# use the silver searcher for git jump grep +git config jump.grepCmd "ag --column" --------------------------------------------------
contrib/git-jump/git-jump +5 -2
@@ -11,7 +11,8 @@ diff: elements are diff hunks. Arguments are given to diff. merge: elements are merge conflicts. Arguments are ignored. -grep: elements are grep hits. Arguments are given to grep. +grep: elements are grep hits. Arguments are given to git grep or, if + configured, to the command in `jump.grepCmd`. ws: elements are whitespace errors. Arguments are given to diff --check. EOF
@@ -50,7 +51,9 @@ mode_merge() { # but let's clean up extra whitespace, so they look better if the # editor shows them to us in the status bar. mode_grep() { - git grep -n "$@" | + cmd=$(git config jump.grepCmd) + test -n "$cmd" || cmd="git grep -n" + $cmd "$@" | perl -pe ' s/[ \t]+/ /g; s/^ *//;
Signature · 1 line
2.15.0.rc1.299.gda03b47c3
Quoted 6 lines · Beat Bolli
Add the configuration option "jump.grepCmd" that allows to configure the command that is used to search in grep mode. This allows the users of git-jump to use ag(1) or ack(1) as search engines.
Signed-off-by Beat Bolli <[email protected]>---
Thanks. The contrib/README file has this to say (also read the surrounding text):
... If
you have patches to things in contrib/ area, the patch should be first sent to the primary author, and then the primary author should ack and forward it to me (git pull request is nicer).
Peff, I think we need a clear indication in contrib/git-jump/README to whom patches to the area should be sent. I know how to run
$ git shortlog -n --no-merges contrib/git-jump
but not everybody does (or bothers).
Quoted 43 lines
contrib/git-jump/README | 3 +++ contrib/git-jump/git-jump | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)contrib/git-jump/README +3
-0@@ -63,6 +63,9 @@ git jump grep foo_bar # same as above, but case-insensitive; you can give # arbitrary grep options git jump grep -i foo_bar + +# use the silver searcher for git jump grep +git config jump.grepCmd "ag --column" --------------------------------------------------contrib/git-jump/git-jump +5
-2@@ -11,7 +11,8 @@ diff: elements are diff hunks. Arguments are given to diff. merge: elements are merge conflicts. Arguments are ignored. -grep: elements are grep hits. Arguments are given to grep. +grep: elements are grep hits. Arguments are given to git grep or, if + configured, to the command in `jump.grepCmd`. ws: elements are whitespace errors. Arguments are given to diff --check. EOF@@ -50,7 +51,9 @@ mode_merge() { # but let's clean up extra whitespace, so they look better if the # editor shows them to us in the status bar. mode_grep() { - git grep -n "$@" | + cmd=$(git config jump.grepCmd) + test -n "$cmd" || cmd="git grep -n" + $cmd "$@" | perl -pe ' s/[ \t]+/ /g; s/^ *//;
Quoted 9 lines · Junio C Hamano
Quoted 6 lines · Beat Bolli
Add the configuration option "jump.grepCmd" that allows to configure the command that is used to search in grep mode. This allows the users of git-jump to use ag(1) or ack(1) as search engines.
Signed-off-by Beat Bolli <[email protected]>---
Quoted 7 lines
Thanks. The contrib/README file has this to say (also read the surrounding text):
... If
you have patches to things in contrib/ area, the patch should be first sent to the primary author, and then the primary author should ack and forward it to me (git pull request is nicer).
I'm not sure the "ack and forward" and "pull request" bits necessarily make sense here, as I do not host git-jump as a separate repository. I'd expect people to send to the list and cc me, and you'd pick it up as long as I'd ack'd it.
But I'm happy to revisit that if you prefer to do it a different way. We could even pull it out of contrib/ entirely and I could just host it as a separate project entirely.
Quoted 6 lines
Peff, I think we need a clear indication in contrib/git-jump/README to whom patches to the area should be sent. I know how to run
$ git shortlog -n --no-merges contrib/git-jumpbut not everybody does (or bothers).
How about this?
-- >8 --
Subject: [PATCH] git-jump: give contact instructions in the README
Let's make it clear how patches should flow into contrib/git-jump. The normal Git maintainer does not necessarily care about things in contrib/, and authors of individual components should be the ones giving the final review/ack for a patch. Ditto for bug reports, which are likely to get more attention from the area expert.
--- contrib/git-jump/README | 7 +++++++ 1 file changed, 7 insertions(+)
contrib/git-jump/README +7 -0
@@ -92,3 +92,10 @@ how to activate it. The shell snippets to generate the quickfix lines will almost certainly choke on filenames with exotic characters (like newlines). + +Contributing +------------ + +Bug fixes, bug reports, and feature requests should be discussed on the +Git mailing list <[email protected]>, and cc'd to the git-jump +maintainer, Jeff King <[email protected]>.
Signature · 1 line
2.15.0.494.g79a8547723
Quoted 3 lines · Beat Bolli
Add the configuration option "jump.grepCmd" that allows to configure the command that is used to search in grep mode. This allows the users of git-jump to use ag(1) or ack(1) as search engines.
This patch looks good to me. The user needs to be careful to use some option that shows the line number, but that's hopefully obvious from your example.
contrib/git-jump/README git jump grep foo_bar · line 68
Quoted 2 lines
contrib/git-jump/README +2
-0+# use the silver searcher for git jump grep +git config jump.grepCmd "ag --column"
I wondered what "vim -q" would do with the --column output. Quite nicely, it puts the cursor right where you'd want it to be. I'm tempted to teach "git grep" the same option. ;)
-Peff
Jonathan Nieder
Reviewed-byQuoted 9 lines · Jeff King
Subject: [PATCH] git-jump: give contact instructions in the README
Let's make it clear how patches should flow into contrib/git-jump. The normal Git maintainer does not necessarily care about things in contrib/, and authors of individual components should be the ones giving the final review/ack for a patch. Ditto for bug reports, which are likely to get more attention from the area expert.
Quoted 4 lines
Signed-off-by Jeff King <[email protected]>--- contrib/git-jump/README | 7 +++++++ 1 file changed, 7 insertions(+)
Thanks for making it clearer.
Quoted 15 lines
contrib/git-jump/README +7
-0@@ -92,3 +92,10 @@ how to activate it. The shell snippets to generate the quickfix lines will almost certainly choke on filenames with exotic characters (like newlines). + +Contributing +------------ + +Bug fixes, bug reports, and feature requests should be discussed on the +Git mailing list <[email protected]>, and cc'd to the git-jump +maintainer, Jeff King <[email protected]>.
Quoted 22 lines · Jeff King
How about this?
-- >8 --
Subject: [PATCH] git-jump: give contact instructions in the READMELet's make it clear how patches should flow into contrib/git-jump. The normal Git maintainer does not necessarily care about things in contrib/, and authors of individual components should be the ones giving the final review/ack for a patch. Ditto for bug reports, which are likely to get more attention from the area expert.
Signed-off-by Jeff King <[email protected]>--- contrib/git-jump/README | 7 +++++++ 1 file changed, 7 insertions(+)contrib/git-jump/README +0
-0
contrib/git-jump/README how to activate it. · line 101
Quoted 10 lines
contrib/git-jump/README +7
-0@@ -92,3 +92,10 @@ how to activate it. The shell snippets to generate the quickfix lines will almost certainly choke on filenames with exotic characters (like newlines). + +Contributing +------------ + +Bug fixes, bug reports, and feature requests should be discussed on the +Git mailing list <[email protected]>, and cc'd to the git-jump +maintainer, Jeff King <[email protected]>.
Thanks, will queue.