git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Tan <jonathantanmy@google.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH 6/7] grep: avoid resolving revision names in --no-index case
Date: Tue, 14 Feb 2017 08:53:04 -0800	[thread overview]
Message-ID: <eef97cc4-d616-b298-bc99-b2772b757190@google.com> (raw)
In-Reply-To: <20170214060729.v4r24y5tuaov3jrh@sigill.intra.peff.net>

On 02/13/2017 10:07 PM, Jeff King wrote:
> diff --git a/builtin/grep.c b/builtin/grep.c
> index e83b33bda..c4c632594 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -1176,6 +1176,12 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
>  			break;
>  		}
>
> +		if (!use_index) {
> +			if (seen_dashdash)
> +				die(_("--no-index cannot be used with revs"));

There is a subsequent check that prints "--no-index or --untracked 
cannot be used with revs." - maybe we should just expand this part to 
incorporate that case. (That is, write `if (!use_index || untracked)` 
instead of `if (!use_index)`.) This also allows us to preserve the error 
message, which might be useful for someone using a translated version of 
Git.

> +			break;
> +		}
> +
>  		if (get_sha1_with_context(arg, 0, sha1, &oc)) {
>  			if (seen_dashdash)
>  				die(_("unable to resolve revision: %s"), arg);

  reply	other threads:[~2017-02-14 16:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14  0:11 [PATCH for NEXT] grep: do not unnecessarily query repo for "--" Jonathan Tan
2017-02-14  1:20 ` Jeff King
2017-02-14  6:00   ` [PATCH 0/7] grep rev/path parsing fixes Jeff King
2017-02-14  6:02     ` [PATCH 1/7] grep: move thread initialization a little lower Jeff King
2017-02-14 18:46       ` Brandon Williams
2017-02-14  6:03     ` [PATCH 2/7] grep: do not unnecessarily query repo for "--" Jeff King
2017-02-14  6:03     ` [PATCH 3/7] t7810: make "--no-index --" test more robust Jeff King
2017-02-14  6:04     ` [PATCH 4/7] grep: re-order rev-parsing loop Jeff King
2017-02-14 18:48       ` Brandon Williams
2017-02-14  6:05     ` [PATCH 5/7] grep: fix "--" rev/pathspec disambiguation Jeff King
2017-02-14 18:56       ` Brandon Williams
2017-02-14 19:51         ` Jeff King
2017-02-14 19:18       ` Junio C Hamano
2017-02-14  6:07     ` [PATCH 6/7] grep: avoid resolving revision names in --no-index case Jeff King
2017-02-14 16:53       ` Jonathan Tan [this message]
2017-02-14 18:04         ` Jeff King
2017-02-14 18:19           ` Jonathan Tan
2017-02-14 21:54             ` [PATCH 8/7] grep: treat revs the same for --untracked as for --no-index Jeff King
2017-02-14 21:58               ` Junio C Hamano
2017-02-14  6:08     ` [PATCH 7/7] grep: do not diagnose misspelt revs with --no-index Jeff King
2017-02-14  6:10     ` [PATCH 0/7] grep rev/path parsing fixes Jeff King
2017-02-14 16:58     ` Jonathan Tan

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eef97cc4-d616-b298-bc99-b2772b757190@google.com \
    --to=jonathantanmy@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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.
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).