threads / bug / 33537

Bug with rev-list --reverse?

Subject: Bug with rev-list --reverse?

## tl;dr

7 messages between Apr 18, 2013 and Apr 18, 2013.

replies: 6people: 5as markdown or json

Felipe Contreras· Apr 18, 2013, 10:17 UTC · lore
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· Apr 18, 2013, 10:26 UTC · re: Felipe Contreras · lore

Re: Bug with rev-list --reverse?

On Thu, Apr 18, 2013 at 05:17:14AM -0500, Felipe Contreras wrote:
Show 7 quoted lines
> 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.

Felipe Contreras· Apr 18, 2013, 11:15 UTC · re: John Keeping · lore

Re: Bug with rev-list --reverse?

On Thu, Apr 18, 2013 at 5:26 AM, John Keeping <john@keeping.me.uk> wrote:
Show 13 quoted lines
> 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
Peter Krefting· Apr 18, 2013, 10:47 UTC · re: Felipe Contreras · lore

Re: Bug with rev-list --reverse?

Felipe Contreras:
Show 5 quoted lines
> % 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· Apr 18, 2013, 11:18 UTC · re: Peter Krefting · lore

Re: Bug with rev-list --reverse?

On Thu, Apr 18, 2013 at 5:47 AM, Peter Krefting <peter@softwolves.pp.se> wrote:
Show 16 quoted lines
>> % 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· Apr 18, 2013, 14:25 UTC · re: Felipe Contreras · lore

Re: Bug with rev-list --reverse?

Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 25 quoted lines
> 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· Apr 18, 2013, 17:25 UTC · re: Thomas Rast · lore

Re: Bug with rev-list --reverse?

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.

← back to recent threads