From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>, Beat Bolli <dev+git@drbeat.li>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] contrib/git-jump: allow to configure the grep command
Date: Mon, 20 Nov 2017 12:11:13 +0900 [thread overview]
Message-ID: <xmqqh8tpmypa.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171119230536.1628-1-dev+git@drbeat.li> (Beat Bolli's message of "Mon, 20 Nov 2017 00:05:36 +0100")
Beat Bolli <dev+git@drbeat.li> writes:
> 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 <dev+git@drbeat.li>
> ---
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).
> contrib/git-jump/README | 3 +++
> contrib/git-jump/git-jump | 7 +++++--
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/git-jump/README b/contrib/git-jump/README
> index 225e3f095..9f58d5db8 100644
> --- a/contrib/git-jump/README
> +++ b/contrib/git-jump/README
> @@ -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"
> --------------------------------------------------
>
>
> diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump
> index 427f206a4..80ab0590b 100755
> --- a/contrib/git-jump/git-jump
> +++ b/contrib/git-jump/git-jump
> @@ -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/^ *//;
next prev parent reply other threads:[~2017-11-20 3:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-19 23:05 [PATCH] contrib/git-jump: allow to configure the grep command Beat Bolli
2017-11-20 3:11 ` Junio C Hamano [this message]
2017-11-20 19:18 ` Jeff King
2017-11-20 19:55 ` Jonathan Nieder
2017-11-21 1:58 ` Junio C Hamano
2017-11-20 19:20 ` Jeff King
-- strict thread matches above, loose matches on Subject: below --
2017-11-09 20:30 Beat Bolli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh8tpmypa.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=dev+git@drbeat.li \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).