# Bug with rev-list --reverse?

7 messages from 2013-04-18 to 2013-04-18. Participants: Felipe Contreras, John Keeping, Peter Krefting, Thomas Rast, Junio C Hamano.
Thread: https://gitlist.dev/t/33537

## Felipe Contreras, 2013-04-18 10:17

Subject: Bug with rev-list --reverse?
Message-ID: <CAMP44s25mUA1M+K+YKaC=bz3Dr7kSDyXK5g2ot8i+1EPy8zRhA@mail.gmail.com>
URL: https://gitlist.dev/e/CAMP44s25mUA1M%2BK%2BYKaC%3Dbz3Dr7kSDyXK5g2ot8i%2B1EPy8zRhA%40mail.gmail.com

```
Hi,

If I do these:

% git log --oneline -1 v1.8.1.5^..v1.8.1.6
% git log --oneline --reverse -1 v1.8.1.5^..v1.8.1.6

I expect to get a different output, and not both showing v1.8.1.6.
Wouldn't you agree?

Cheers.

-- 
Felipe Contreras

```

## John Keeping, 2013-04-18 10:26

Subject: Re: Bug with rev-list --reverse?
Message-ID: <20130418102644.GY2278@serenity.lan>
URL: https://gitlist.dev/e/20130418102644.GY2278%40serenity.lan
In-Reply-To: <CAMP44s25mUA1M+K+YKaC=bz3Dr7kSDyXK5g2ot8i+1EPy8zRhA@mail.gmail.com>

```
On Thu, Apr 18, 2013 at 05:17:14AM -0500, Felipe Contreras wrote:
> If I do these:
> 
> % git log --oneline -1 v1.8.1.5^..v1.8.1.6
> % git log --oneline --reverse -1 v1.8.1.5^..v1.8.1.6
> 
> I expect to get a different output, and not both showing v1.8.1.6.
> Wouldn't you agree?

I expect to get the same output.  This is probably because I consider
--reverse to be an output filter.  So I expect to show the commits
"v1.8.1.5^..v1.8.1.6 -1" which selects a single commit and then show
that in reverse order.

```

## Peter Krefting, 2013-04-18 10:47

Subject: Re: Bug with rev-list --reverse?
Message-ID: <alpine.DEB.2.00.1304181146090.30868@ds9.cixit.se>
URL: https://gitlist.dev/e/alpine.DEB.2.00.1304181146090.30868%40ds9.cixit.se
In-Reply-To: <CAMP44s25mUA1M+K+YKaC=bz3Dr7kSDyXK5g2ot8i+1EPy8zRhA@mail.gmail.com>

```
Felipe Contreras:

> % git log --oneline -1 v1.8.1.5^..v1.8.1.6
> % git log --oneline --reverse -1 v1.8.1.5^..v1.8.1.6
>
> I expect to get a different output, and not both showing v1.8.1.6.
> Wouldn't you agree?

  Quoting the manual page:

  Commit Limiting
    Besides specifying a range of commits that should be listed using the special notations explained in the description, additional commit limiting may be applied. Note that they are applied before commit ordering and formatting options, such as --reverse.

Given that, I would expect the output to be the same.

-- 
\\// Peter - http://www.softwolves.pp.se/

```

## Felipe Contreras, 2013-04-18 11:15

Subject: Re: Bug with rev-list --reverse?
Message-ID: <CAMP44s1np9vxZS6N2+w-K=zzRhq4x2+eFBzu-HJMeoNjk7ze-Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAMP44s1np9vxZS6N2%2Bw-K%3DzzRhq4x2%2BeFBzu-HJMeoNjk7ze-Q%40mail.gmail.com
In-Reply-To: <20130418102644.GY2278@serenity.lan>

```
On Thu, Apr 18, 2013 at 5:26 AM, John Keeping <john@keeping.me.uk> wrote:
> On Thu, Apr 18, 2013 at 05:17:14AM -0500, Felipe Contreras wrote:
>> If I do these:
>>
>> % git log --oneline -1 v1.8.1.5^..v1.8.1.6
>> % git log --oneline --reverse -1 v1.8.1.5^..v1.8.1.6
>>
>> I expect to get a different output, and not both showing v1.8.1.6.
>> Wouldn't you agree?
>
> I expect to get the same output.  This is probably because I consider
> --reverse to be an output filter.  So I expect to show the commits
> "v1.8.1.5^..v1.8.1.6 -1" which selects a single commit and then show
> that in reverse order.

How about this:

% git log --oneline --reverse --max-count=1 v1.8.1.5^..v1.8.1.6

In this case --max-count is acting as "start from the first commit
before the tip", not as "output a maximum of one commit". Given that
the name is max-count, I expect it to be the later.

And if max-count doesn't select a maximum of n commits, then what does?

-- 
Felipe Contreras

```

## Felipe Contreras, 2013-04-18 11:18

Subject: Re: Bug with rev-list --reverse?
Message-ID: <CAMP44s014Yv9+N7=0CYiYYybJCZJ7r-vQp_zcfg6Xo=3f21RWA@mail.gmail.com>
URL: https://gitlist.dev/e/CAMP44s014Yv9%2BN7%3D0CYiYYybJCZJ7r-vQp_zcfg6Xo%3D3f21RWA%40mail.gmail.com
In-Reply-To: <alpine.DEB.2.00.1304181146090.30868@ds9.cixit.se>

```
On Thu, Apr 18, 2013 at 5:47 AM, Peter Krefting <peter@softwolves.pp.se> wrote:

>> % git log --oneline -1 v1.8.1.5^..v1.8.1.6
>> % git log --oneline --reverse -1 v1.8.1.5^..v1.8.1.6
>>
>> I expect to get a different output, and not both showing v1.8.1.6.
>> Wouldn't you agree?
>
>
>  Quoting the manual page:
>
>  Commit Limiting
>    Besides specifying a range of commits that should be listed using the
> special notations explained in the description, additional commit limiting
> may be applied. Note that they are applied before commit ordering and
> formatting options, such as --reverse.
>
> Given that, I would expect the output to be the same.

If expectations were based on documentation, all one has to do is
document bugs, and there would be no bugs anymore :)

Code can be changed to fit more appropriately user expectations (which
are independent of documentation), and the documentation updated
accordingly.

-- 
Felipe Contreras

```

## Thomas Rast, 2013-04-18 14:25

Subject: Re: Bug with rev-list --reverse?
Message-ID: <87k3nzx6dn.fsf@linux-k42r.v.cablecom.net>
URL: https://gitlist.dev/e/87k3nzx6dn.fsf%40linux-k42r.v.cablecom.net
In-Reply-To: <CAMP44s014Yv9+N7=0CYiYYybJCZJ7r-vQp_zcfg6Xo=3f21RWA@mail.gmail.com>

```
Felipe Contreras <felipe.contreras@gmail.com> writes:

> On Thu, Apr 18, 2013 at 5:47 AM, Peter Krefting <peter@softwolves.pp.se> wrote:
>
>>> % git log --oneline -1 v1.8.1.5^..v1.8.1.6
>>> % git log --oneline --reverse -1 v1.8.1.5^..v1.8.1.6
>>>
>>> I expect to get a different output, and not both showing v1.8.1.6.
>>> Wouldn't you agree?
>>
>>
>>  Quoting the manual page:
>>
>>  Commit Limiting
>>    Besides specifying a range of commits that should be listed using the
>> special notations explained in the description, additional commit limiting
>> may be applied. Note that they are applied before commit ordering and
>> formatting options, such as --reverse.
>>
>> Given that, I would expect the output to be the same.
>
> If expectations were based on documentation, all one has to do is
> document bugs, and there would be no bugs anymore :)
>
> Code can be changed to fit more appropriately user expectations (which
> are independent of documentation), and the documentation updated
> accordingly.

It's been this way forever, and applies to rev-list where we can't just
break how options work (for fear of breaking scripts).

You could come up with a patch series that first starts emitting
warnings whenever the user asks for behavior that will change, and later
flips the default and removes the warning (the latter would be merged
for 2.0 or so).

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

```

## Junio C Hamano, 2013-04-18 17:25

Subject: Re: Bug with rev-list --reverse?
Message-ID: <7vvc7j7nut.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vvc7j7nut.fsf%40alter.siamese.dyndns.org
In-Reply-To: <87k3nzx6dn.fsf@linux-k42r.v.cablecom.net>

```
Thomas Rast <trast@inf.ethz.ch> writes:

> You could come up with a patch series that first starts emitting
> warnings whenever the user asks for behavior that will change, and later
> flips the default and removes the warning (the latter would be merged
> for 2.0 or so).

Please don't.  The fact that "reverse then count" mode may be useful
does not mean "count then show in reverse" mode does not have any
use. "git log --oneline --reverse -20" is a very valid way to ask
"what did I do recently" and get "you did this, that and then..." in
that order.

Adding a new option can be done anytime without any complex
transition plan.  You may want to introduce a --show-in-reverse
synonym to the current --reverse when you add the new mode of
reversing (--reverse-before-count?) so that eventually we won't have
to ask "which kind of reverse an unadorned --reverse option mean?"
by deprecating a plain "--reverse", though.

```
