{"thread":{"id":"47245","subject":"[PATCH] contrib/git-jump: allow to configure the grep command","startedAt":"2017-11-19T23:05:52Z","lastAt":"2017-11-21T01:58:55Z","messageCount":6,"participants":["Beat Bolli","Junio C Hamano","Jeff King","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"332879","messageId":"20171119230536.1628-1-dev+git@drbeat.li","threadId":"47245","inReplyTo":null,"subject":"[PATCH] contrib/git-jump: allow to configure the grep command","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2017-11-19T23:05:36Z","receivedAt":"2017-11-19T23:05:52Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"Add the configuration option \"jump.grepCmd\" that allows to configure the\ncommand that is used to search in grep mode. This allows the users of\ngit-jump to use ag(1) or ack(1) as search engines.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n contrib/git-jump/README   | 3 +++\n contrib/git-jump/git-jump | 7 +++++--\n 2 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/git-jump/README b/contrib/git-jump/README\nindex 225e3f095..9f58d5db8 100644\n--- a/contrib/git-jump/README\n+++ b/contrib/git-jump/README\n@@ -63,6 +63,9 @@ git jump grep foo_bar\n # same as above, but case-insensitive; you can give\n # arbitrary grep options\n git jump grep -i foo_bar\n+\n+# use the silver searcher for git jump grep\n+git config jump.grepCmd \"ag --column\"\n --------------------------------------------------\n \n \ndiff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\nindex 427f206a4..80ab0590b 100755\n--- a/contrib/git-jump/git-jump\n+++ b/contrib/git-jump/git-jump\n@@ -11,7 +11,8 @@ diff: elements are diff hunks. Arguments are given to diff.\n \n merge: elements are merge conflicts. Arguments are ignored.\n \n-grep: elements are grep hits. Arguments are given to grep.\n+grep: elements are grep hits. Arguments are given to git grep or, if\n+      configured, to the command in `jump.grepCmd`.\n \n ws: elements are whitespace errors. Arguments are given to diff --check.\n EOF\n@@ -50,7 +51,9 @@ mode_merge() {\n # but let's clean up extra whitespace, so they look better if the\n # editor shows them to us in the status bar.\n mode_grep() {\n-\tgit grep -n \"$@\" |\n+\tcmd=$(git config jump.grepCmd)\n+\ttest -n \"$cmd\" || cmd=\"git grep -n\"\n+\t$cmd \"$@\" |\n \tperl -pe '\n \ts/[ \\t]+/ /g;\n \ts/^ *//;\n-- \n2.15.0.rc1.299.gda03b47c3\n\n"},{"id":"332891","messageId":"xmqqh8tpmypa.fsf@gitster.mtv.corp.google.com","threadId":"47245","inReplyTo":"20171119230536.1628-1-dev+git@drbeat.li","subject":"Re: [PATCH] contrib/git-jump: allow to configure the grep command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-11-20T03:11:13Z","receivedAt":"2017-11-20T03:11:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Beat Bolli <dev+git@drbeat.li> writes:\n\n> Add the configuration option \"jump.grepCmd\" that allows to configure the\n> command that is used to search in grep mode. This allows the users of\n> git-jump to use ag(1) or ack(1) as search engines.\n>\n> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n> ---\n\nThanks.  The contrib/README file has this to say (also read the\nsurrounding text):\n\n    ... If\n    you have patches to things in contrib/ area, the patch should be\n    first sent to the primary author, and then the primary author\n    should ack and forward it to me (git pull request is nicer).\n\nPeff, I think we need a clear indication in contrib/git-jump/README\nto whom patches to the area should be sent.  I know how to run \n\n    $ git shortlog -n --no-merges contrib/git-jump\n\nbut not everybody does (or bothers).\n\n>  contrib/git-jump/README   | 3 +++\n>  contrib/git-jump/git-jump | 7 +++++--\n>  2 files changed, 8 insertions(+), 2 deletions(-)\n>\n> diff --git a/contrib/git-jump/README b/contrib/git-jump/README\n> index 225e3f095..9f58d5db8 100644\n> --- a/contrib/git-jump/README\n> +++ b/contrib/git-jump/README\n> @@ -63,6 +63,9 @@ git jump grep foo_bar\n>  # same as above, but case-insensitive; you can give\n>  # arbitrary grep options\n>  git jump grep -i foo_bar\n> +\n> +# use the silver searcher for git jump grep\n> +git config jump.grepCmd \"ag --column\"\n>  --------------------------------------------------\n>  \n>  \n> diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\n> index 427f206a4..80ab0590b 100755\n> --- a/contrib/git-jump/git-jump\n> +++ b/contrib/git-jump/git-jump\n> @@ -11,7 +11,8 @@ diff: elements are diff hunks. Arguments are given to diff.\n>  \n>  merge: elements are merge conflicts. Arguments are ignored.\n>  \n> -grep: elements are grep hits. Arguments are given to grep.\n> +grep: elements are grep hits. Arguments are given to git grep or, if\n> +      configured, to the command in `jump.grepCmd`.\n>  \n>  ws: elements are whitespace errors. Arguments are given to diff --check.\n>  EOF\n> @@ -50,7 +51,9 @@ mode_merge() {\n>  # but let's clean up extra whitespace, so they look better if the\n>  # editor shows them to us in the status bar.\n>  mode_grep() {\n> -\tgit grep -n \"$@\" |\n> +\tcmd=$(git config jump.grepCmd)\n> +\ttest -n \"$cmd\" || cmd=\"git grep -n\"\n> +\t$cmd \"$@\" |\n>  \tperl -pe '\n>  \ts/[ \\t]+/ /g;\n>  \ts/^ *//;\n"},{"id":"332929","messageId":"20171120191846.pco4wfsu2ptci3uv@sigill.intra.peff.net","threadId":"47245","inReplyTo":"xmqqh8tpmypa.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] contrib/git-jump: allow to configure the grep command","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-11-20T19:18:46Z","receivedAt":"2017-11-20T19:18:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Nov 20, 2017 at 12:11:13PM +0900, Junio C Hamano wrote:\n\n> Beat Bolli <dev+git@drbeat.li> writes:\n> \n> > Add the configuration option \"jump.grepCmd\" that allows to configure the\n> > command that is used to search in grep mode. This allows the users of\n> > git-jump to use ag(1) or ack(1) as search engines.\n> >\n> > Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n> > ---\n> \n> Thanks.  The contrib/README file has this to say (also read the\n> surrounding text):\n> \n>     ... If\n>     you have patches to things in contrib/ area, the patch should be\n>     first sent to the primary author, and then the primary author\n>     should ack and forward it to me (git pull request is nicer).\n\nI'm not sure the \"ack and forward\" and \"pull request\" bits necessarily\nmake sense here, as I do not host git-jump as a separate repository.\nI'd expect people to send to the list and cc me, and you'd pick it up as\nlong as I'd ack'd it.\n\nBut I'm happy to revisit that if you prefer to do it a different way. We\ncould even pull it out of contrib/ entirely and I could just host it as\na separate project entirely.\n\n> Peff, I think we need a clear indication in contrib/git-jump/README\n> to whom patches to the area should be sent.  I know how to run \n> \n>     $ git shortlog -n --no-merges contrib/git-jump\n> \n> but not everybody does (or bothers).\n\nHow about this?\n\n-- >8 --\nSubject: [PATCH] git-jump: give contact instructions in the README\n\nLet's make it clear how patches should flow into\ncontrib/git-jump. The normal Git maintainer does not\nnecessarily care about things in contrib/, and authors of\nindividual components should be the ones giving the final\nreview/ack for a patch. Ditto for bug reports, which are\nlikely to get more attention from the area expert.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n contrib/git-jump/README | 7 +++++++\n 1 file changed, 7 insertions(+)\n\ndiff --git a/contrib/git-jump/README b/contrib/git-jump/README\nindex 225e3f0954..4257cef2e6 100644\n--- a/contrib/git-jump/README\n+++ b/contrib/git-jump/README\n@@ -92,3 +92,10 @@ how to activate it.\n \n The shell snippets to generate the quickfix lines will almost certainly\n choke on filenames with exotic characters (like newlines).\n+\n+Contributing\n+------------\n+\n+Bug fixes, bug reports, and feature requests should be discussed on the\n+Git mailing list <git@vger.kernel.org>, and cc'd to the git-jump\n+maintainer, Jeff King <peff@peff.net>.\n-- \n2.15.0.494.g79a8547723\n"},{"id":"332931","messageId":"20171120192011.i3nsulvnswshwdlr@sigill.intra.peff.net","threadId":"47245","inReplyTo":"20171119230536.1628-1-dev+git@drbeat.li","subject":"Re: [PATCH] contrib/git-jump: allow to configure the grep command","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-11-20T19:20:11Z","receivedAt":"2017-11-20T19:20:17Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Nov 20, 2017 at 12:05:36AM +0100, Beat Bolli wrote:\n\n> Add the configuration option \"jump.grepCmd\" that allows to configure the\n> command that is used to search in grep mode. This allows the users of\n> git-jump to use ag(1) or ack(1) as search engines.\n\nThis patch looks good to me. The user needs to be careful to use some\noption that shows the line number, but that's hopefully obvious from\nyour example.\n\n> +# use the silver searcher for git jump grep\n> +git config jump.grepCmd \"ag --column\"\n\nI wondered what \"vim -q\" would do with the --column output. Quite\nnicely, it puts the cursor right where you'd want it to be. I'm tempted\nto teach \"git grep\" the same option. ;)\n\n-Peff\n"},{"id":"332932","messageId":"20171120195532.yearckl3pbc26iae@aiede.mtv.corp.google.com","threadId":"47245","inReplyTo":"20171120191846.pco4wfsu2ptci3uv@sigill.intra.peff.net","subject":"Re: [PATCH] contrib/git-jump: allow to configure the grep command","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-11-20T19:55:32Z","receivedAt":"2017-11-20T19:55:40Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeff King wrote:\n\n> Subject: [PATCH] git-jump: give contact instructions in the README\n>\n> Let's make it clear how patches should flow into\n> contrib/git-jump. The normal Git maintainer does not\n> necessarily care about things in contrib/, and authors of\n> individual components should be the ones giving the final\n> review/ack for a patch. Ditto for bug reports, which are\n> likely to get more attention from the area expert.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  contrib/git-jump/README | 7 +++++++\n>  1 file changed, 7 insertions(+)\n\nThanks for making it clearer.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\n> diff --git a/contrib/git-jump/README b/contrib/git-jump/README\n> index 225e3f0954..4257cef2e6 100644\n> --- a/contrib/git-jump/README\n> +++ b/contrib/git-jump/README\n> @@ -92,3 +92,10 @@ how to activate it.\n>  \n>  The shell snippets to generate the quickfix lines will almost certainly\n>  choke on filenames with exotic characters (like newlines).\n> +\n> +Contributing\n> +------------\n> +\n> +Bug fixes, bug reports, and feature requests should be discussed on the\n> +Git mailing list <git@vger.kernel.org>, and cc'd to the git-jump\n> +maintainer, Jeff King <peff@peff.net>.\n"},{"id":"333041","messageId":"xmqqh8tojsto.fsf@gitster.mtv.corp.google.com","threadId":"47245","inReplyTo":"20171120191846.pco4wfsu2ptci3uv@sigill.intra.peff.net","subject":"Re: [PATCH] contrib/git-jump: allow to configure the grep command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-11-21T01:58:43Z","receivedAt":"2017-11-21T01:58:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> How about this?\n>\n> -- >8 --\n> Subject: [PATCH] git-jump: give contact instructions in the README\n>\n> Let's make it clear how patches should flow into\n> contrib/git-jump. The normal Git maintainer does not\n> necessarily care about things in contrib/, and authors of\n> individual components should be the ones giving the final\n> review/ack for a patch. Ditto for bug reports, which are\n> likely to get more attention from the area expert.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  contrib/git-jump/README | 7 +++++++\n>  1 file changed, 7 insertions(+)\n>\n> diff --git a/contrib/git-jump/README b/contrib/git-jump/README\n> index 225e3f0954..4257cef2e6 100644\n> --- a/contrib/git-jump/README\n> +++ b/contrib/git-jump/README\n> @@ -92,3 +92,10 @@ how to activate it.\n>  \n>  The shell snippets to generate the quickfix lines will almost certainly\n>  choke on filenames with exotic characters (like newlines).\n> +\n> +Contributing\n> +------------\n> +\n> +Bug fixes, bug reports, and feature requests should be discussed on the\n> +Git mailing list <git@vger.kernel.org>, and cc'd to the git-jump\n> +maintainer, Jeff King <peff@peff.net>.\n\nThanks, will queue.\n"}]}