git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Jiang Xin <worldhello.net@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Git List <git@vger.kernel.org>,
	Jiang Xin <zhiyou.jx@alibaba-inc.com>
Subject: Re: [PATCH] revision: allow pseudo options after --end-of-options
Date: Sat, 10 Jul 2021 21:54:16 +0000	[thread overview]
Message-ID: <YOoXCJV2ssef/KsN@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CANYiYbGYzbMoU_2wb4duppASoYUjGLsJsr692Xe3GaVBOXUsBA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2347 bytes --]

On 2021-07-09 at 01:33:23, Jiang Xin wrote:
> New test case in t6000 covered this case. Branch "--output=yikes"
> which starts with a dash is used as revision after the option
> "--end-of-options", and it won't be interpreted as an option.
> 
>     test_expect_success 'parse pseudo option "--not" after "--end-of-options"' '
>         cat >expect <<-EOF &&
>         > three
>         EOF
>         git log --pretty="%m %s" --end-of-options \
>                 HEAD --not --output=yikes -- \
>                 two/three >actual &&
>         test_cmp expect actual
>     '
> 
> But for the original implementation, because pseudo revision options
> (--branches, --tags, --not, ..., etc) can not be used after the
> "--end-of-options" option, we have to put "--end-of-options" at the
> end of revisions, such as:
> 
>     git log --pretty="%m %s" rev1 --not rev2 rev3 rev4 \
>             --end-of-options -- path/file

Or you could just use the other syntax and not have the problem.  Or you
could write this:

  git log --pretty="%m %s" refs/heads/rev1 --not --end-of-options rev2 rev3 rev4 \
          -- path/file

Unless there's a functional problem we're trying to solve, I'd much
rather we didn't make --end-of-options means
--end-of-some-options-but-not-others.  That makes it hard to reason
about, and if someone does have a need for disabling all options, then
we have to add another option.  It's also incompatible with the previous
behavior, so whereas "--not" used to be a revision, now it's an option.

It's unfortunate that we're not using -- here instead of
--end-of-options because the former is the standard syntax, but that's
what we have now since that's already used elsewhere.

> Yes, "--end-of-options" must be used if there is a revision which
> starts with dash, such as branch "--output=yikes" in t6000. That's
> even stranger, for we have to write  command in the middle of
> revisions like this:
> 
>     git log --pretty="%m %s" rev1 --not rev2 rev3 \
>             --end-of-options --output=yikes -- path/file
> 
> I know "rev1..rev2" and "rev2 ^rev1", but I prefer to use "rev1 --not
> rev2 rev3" instead of "rev1 ^rev2 ^rev3".

I don't think a personal preference is a good reason to change this.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2021-07-10 21:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 15:03 [PATCH] revision: allow pseudo options after --end-of-options Jiang Xin
2021-07-08 17:01 ` brian m. carlson
2021-07-09  1:33   ` Jiang Xin
2021-07-10 21:54     ` brian m. carlson [this message]
2021-07-12 17:54       ` Jeff King
2021-07-12 18:47         ` Junio C Hamano
2021-07-12 19:47           ` Jeff King
2021-07-12 20:09             ` Junio C Hamano
2021-07-13  8:57         ` Jiang Xin
2021-07-13 21:13           ` Jeff King
2021-07-27  6:10             ` Patrick Steinhardt

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=YOoXCJV2ssef/KsN@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=worldhello.net@gmail.com \
    --cc=zhiyou.jx@alibaba-inc.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.
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).