Re: [PATCH] revision: allow pseudo options after --end-of-options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux