Subject: Re: for-each-ref output order change in 2.7.0

From: Matthieu Moy <[email-masked]>
Date: Sat, 9 Jan 2016 16:40:02 +0100 (CET)

Hi,

Cc-ing Karthik to draw his attention on the message.

----- Original Message -----
> In one of our tests, we have a set of branches whose names are all
> special characters (%, @, etc). Most of them branches have identical
> tip commits and just have different names. In 2.7.0, when ordering by
> -committerdate, the branches are now returned in a different order. I
> don't think this is a bug, based on the commit it bisects to, but I'm
> wondering if someone can confirm.
> 
> 2.6.5 and prior (tested all the way back to 1.7.6, so this was
> consistent for a long time):
> 
> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100
> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100
> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100
> refs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100
> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100
> 
> 2.7.0:
> 
> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100
> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100
> refs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100
> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100
> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100
> 
> I've bisected this back to:
> 
> bturner@ubuntu:~/Development/oss/git/git$ git bisect bad
> 9e468334b41c1d1fc715de177ef1f61a36c1cf01 is the first bad commit
> commit 9e468334b41c1d1fc715de177ef1f61a36c1cf01
> Author: Karthik Nayak <[email-masked]>
> Date:   Fri Oct 30 14:15:28 2015 +0530
> 
>     ref-filter: fallback on alphabetical comparison
> 
> The message for that commit indicates that sorting numerics (which I
> assume is the implementation for committerdate) now falls back on
> alphabetical for identical values, suggesting this order change is
> actually intentional and correct.

And also that the previous order was arbitrary (just letting the sort
algorithm chose which one to put first in case of equality on the main
sorting criterion), so the fact that it was stable previously is more
or less just luck. Now it should be stable.

> Is that right?
> 
> (Note: The alphabetical-ness of the branch names is reversed, which
> seems logical given my original sort was -committerdate. A
> --sort=refname looks like this.
> 
> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100
> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100
> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100
> refs/heads/@#$% - >Tue Jan 3 17:00:51 2012 +1100
> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100
> 
> That's probably more correct too.)
> 
> Best regards,
> Bryan Turner

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/