Re: [PATCH 6/7] grep: avoid resolving revision names in --no-index case
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Feb 14, 2017, 16:53 UTC
- Message-ID
- <eef97cc4-d616-b298-bc99-b2772b757190@google.com>
- In-Reply-To
- <20170214060729.v4r24y5tuaov3jrh@sigill.intra.peff.net>
On 02/13/2017 10:07 PM, Jeff King wrote:
Show 11 quoted lines
> 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.
Show 6 quoted lines
> + break;
> + }
> +
> if (get_sha1_with_context(arg, 0, sha1, &oc)) {
> if (seen_dashdash)
> die(_("unable to resolve revision: %s"), arg);