From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
"Sathyajith Bhat" <sathya@sathyasays.com>,
git@vger.kernel.org
Subject: Re: [PATCH] log: diagnose -L used with pathspec as an error
Date: Wed, 4 Nov 2020 16:03:27 -0500 [thread overview]
Message-ID: <20201104210327.GG3629238@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqy2jglv29.fsf_-_@gitster.c.googlers.com>
On Wed, Nov 04, 2020 at 12:35:10PM -0800, Junio C Hamano wrote:
> The new tests say they may fail with "-L and --follow being
> incompatible" instead of "-L and pathspec being imcompatible".
> Currently the expected failure can come only from the latter, but
> this is to futureproof them, in case we decide to add code to
> explicititly die on -L and --follow used together.
This explanation makes sense (though s/imcompat/incompat/).
> +test_expect_success 'basic command line parsing' '
> + # This may fail due to "no such path a.c in commit", or
> + # "-L is incompatible with pathspec", depending on the
> + # order the error is checked. Either is acceptable.
> + test_must_fail git log -L1,1:a.c -- a.c &&
> +
> + # This must fail due to "-L is incompatible with pathspec".
> + test_must_fail git log -L1,1:b.c -- b.c 2>error &&
> + test_i18ngrep "cannot be used with pathspec" error &&
The renaming makes sense...
> +
> + # Note that incompatibility between -L/--follow is not
> + # explicitly checked to avoid redundant code and the comments
> + # on the following tests are merely for future-proofing.
...as does this comment to explain the rest of the tests.
> + # These must fail due to "follow requires one pathspec", or
> + # "-L is incompatible with --follow", depending on the
> + # order the error is checked. Either is acceptable.
> + test_must_fail git log -L1,1:b.c --follow &&
> + test_must_fail git log --follow -L1,1:b.c &&
> +
> + # This may fail due to "-L is incompatible with pathspec", or
> + # "-L is incompatible with --follow", depending on the
> + # order the error is checked. Either is acceptable.
> + test_must_fail git log --follow -L1,1:b.c -- b.c
> +'
Though "depending on the order" is a bit of a fiction, because those
checks do not exist at all. I'm OK with it because the earlier comment
explains what is going. I guess:
# This may fail due to "-L is incompatible with pathspec", or
# "-L is incompatible with --follow". We don't have the latter as of
# the writing of this test, but either would be acceptable if we added
# it.
would be an alternative. I doubt it's worth spending too much time
polishing.
-Peff
next prev parent reply other threads:[~2020-11-04 21:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 13:59 Segfault in git when using git logs Sathyajith Bhat
2020-11-02 14:43 ` Jeff King
2020-11-02 18:31 ` Junio C Hamano
2020-11-03 10:15 ` SZEDER Gábor
2020-11-03 11:21 ` Christian Couder
2020-11-03 16:10 ` Elijah Newren
2020-11-03 18:21 ` Jeff King
2020-11-03 18:34 ` Junio C Hamano
2020-11-03 18:57 ` Jeff King
2020-11-03 20:21 ` Junio C Hamano
2020-11-04 13:31 ` Jeff King
2020-11-04 16:26 ` Junio C Hamano
2020-11-04 17:54 ` Re*: " Junio C Hamano
2020-11-04 19:41 ` Jeff King
2020-11-04 20:16 ` Junio C Hamano
2020-11-04 20:35 ` [PATCH] log: diagnose -L used with pathspec as an error Junio C Hamano
2020-11-04 21:03 ` Jeff King [this message]
2020-11-03 18:46 ` Segfault in git when using git logs Derrick Stolee
2020-11-03 18:55 ` Sathyajith Bhat
2020-11-03 19:23 ` Jeff King
2020-11-03 20:07 ` Derrick Stolee
2020-11-03 21:04 ` Derrick Stolee
2020-11-04 15:49 ` Sathyajith Bhat
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=20201104210327.GG3629238@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sathya@sathyasays.com \
--cc=szeder.dev@gmail.com \
/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).