git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Karthik Nayak <karthik.188@gmail.com>
Date
Jan 9, 2016, 17:21 UTC
Message-ID
<CAOLa=ZT7n8qCoS81iijf9vswWV+S8n7=4kmbKP0EAMnOenXwSg@mail.gmail.com>
In-Reply-To
<1674931730.811704.1452354002885.JavaMail.zimbra@imag.fr>
Hello,

On Sat, Jan 9, 2016 at 9:10 PM, Matthieu Moy <matthieu.moy@grenoble-inp.fr> wrote:

> Hi,
>
> Cc-ing Karthik to draw his attention on the message.
>
Thanks, I didn't really notice it.
Show 47 quoted lines
> ----- 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 <karthik.188@gmail.com>
>> 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?
>>
Yup, absolutely.
Show 14 quoted lines
>> (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

This is correct as per the patch, But I'm wondering if this is desired. I.E when sorting in reverse order should the fallback (alphabetical sort) also be in reverse order?

-- 
Regards,
Karthik Nayak
Previous: Matthieu MoyNext: Johannes Sixt
Message 3 of 6 in “for-each-ref output order change in 2.7.0”
  1. Bryan TurnerJan 9, 2016
  2. Matthieu MoyJan 9, 2016
  3. Karthik NayakJan 9, 2016
  4. Johannes SixtJan 9, 2016
  5. Karthik NayakJan 9, 2016
  6. Johannes SixtJan 10, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.