{"thread":{"id":"41154","subject":"for-each-ref output order change in 2.7.0","startedAt":"2016-01-09T01:07:37Z","lastAt":"2016-01-10T09:51:52Z","messageCount":6,"participants":["Bryan Turner","Matthieu Moy","Karthik Nayak","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"275588","messageId":"CAGyf7-FSP3Z7HO=LpoQck8q9sSj3fGYCx1=gNa6fXEkovxAxHw@mail.gmail.com","threadId":"41154","inReplyTo":null,"subject":"for-each-ref output order change in 2.7.0","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2016-01-09T01:07:37Z","receivedAt":"2016-01-09T01:07:37Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"In one of our tests, we have a set of branches whose names are all\nspecial characters (%, @, etc). Most of them branches have identical\ntip commits and just have different names. In 2.7.0, when ordering by\n-committerdate, the branches are now returned in a different order. I\ndon't think this is a bug, based on the commit it bisects to, but I'm\nwondering if someone can confirm.\n\n2.6.5 and prior (tested all the way back to 1.7.6, so this was\nconsistent for a long time):\n\nrefs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\nrefs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n\n2.7.0:\n\nrefs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\nrefs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n\nI've bisected this back to:\n\nbturner@ubuntu:~/Development/oss/git/git$ git bisect bad\n9e468334b41c1d1fc715de177ef1f61a36c1cf01 is the first bad commit\ncommit 9e468334b41c1d1fc715de177ef1f61a36c1cf01\nAuthor: Karthik Nayak <karthik.188@gmail.com>\nDate:   Fri Oct 30 14:15:28 2015 +0530\n\n    ref-filter: fallback on alphabetical comparison\n\nThe message for that commit indicates that sorting numerics (which I\nassume is the implementation for committerdate) now falls back on\nalphabetical for identical values, suggesting this order change is\nactually intentional and correct. Is that right?\n\n(Note: The alphabetical-ness of the branch names is reversed, which\nseems logical given my original sort was -committerdate. A\n--sort=refname looks like this.\n\nrefs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\nrefs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/@#$% - >Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n\nThat's probably more correct too.)\n\nBest regards,\nBryan Turner\n"},{"id":"275595","messageId":"1674931730.811704.1452354002885.JavaMail.zimbra@imag.fr","threadId":"41154","inReplyTo":"CAGyf7-FSP3Z7HO=LpoQck8q9sSj3fGYCx1=gNa6fXEkovxAxHw@mail.gmail.com","subject":"Re: for-each-ref output order change in 2.7.0","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2016-01-09T15:40:02Z","receivedAt":"2016-01-09T15:40:02Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Hi,\n\nCc-ing Karthik to draw his attention on the message.\n\n----- Original Message -----\n> In one of our tests, we have a set of branches whose names are all\n> special characters (%, @, etc). Most of them branches have identical\n> tip commits and just have different names. In 2.7.0, when ordering by\n> -committerdate, the branches are now returned in a different order. I\n> don't think this is a bug, based on the commit it bisects to, but I'm\n> wondering if someone can confirm.\n> \n> 2.6.5 and prior (tested all the way back to 1.7.6, so this was\n> consistent for a long time):\n> \n> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n> \n> 2.7.0:\n> \n> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n> \n> I've bisected this back to:\n> \n> bturner@ubuntu:~/Development/oss/git/git$ git bisect bad\n> 9e468334b41c1d1fc715de177ef1f61a36c1cf01 is the first bad commit\n> commit 9e468334b41c1d1fc715de177ef1f61a36c1cf01\n> Author: Karthik Nayak <karthik.188@gmail.com>\n> Date:   Fri Oct 30 14:15:28 2015 +0530\n> \n>     ref-filter: fallback on alphabetical comparison\n> \n> The message for that commit indicates that sorting numerics (which I\n> assume is the implementation for committerdate) now falls back on\n> alphabetical for identical values, suggesting this order change is\n> actually intentional and correct.\n\nAnd also that the previous order was arbitrary (just letting the sort\nalgorithm chose which one to put first in case of equality on the main\nsorting criterion), so the fact that it was stable previously is more\nor less just luck. Now it should be stable.\n\n> Is that right?\n> \n> (Note: The alphabetical-ness of the branch names is reversed, which\n> seems logical given my original sort was -committerdate. A\n> --sort=refname looks like this.\n> \n> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/@#$% - >Tue Jan 3 17:00:51 2012 +1100\n> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n> \n> That's probably more correct too.)\n> \n> Best regards,\n> Bryan Turner\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"275596","messageId":"CAOLa=ZT7n8qCoS81iijf9vswWV+S8n7=4kmbKP0EAMnOenXwSg@mail.gmail.com","threadId":"41154","inReplyTo":"1674931730.811704.1452354002885.JavaMail.zimbra@imag.fr","subject":"Re: for-each-ref output order change in 2.7.0","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2016-01-09T17:21:03Z","receivedAt":"2016-01-09T17:21:03Z","isPatch":false,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"Hello,\n\nOn Sat, Jan 9, 2016 at 9:10 PM, Matthieu Moy\n<matthieu.moy@grenoble-inp.fr> wrote:\n> Hi,\n>\n> Cc-ing Karthik to draw his attention on the message.\n>\n\nThanks, I didn't really notice it.\n\n> ----- Original Message -----\n>> In one of our tests, we have a set of branches whose names are all\n>> special characters (%, @, etc). Most of them branches have identical\n>> tip commits and just have different names. In 2.7.0, when ordering by\n>> -committerdate, the branches are now returned in a different order. I\n>> don't think this is a bug, based on the commit it bisects to, but I'm\n>> wondering if someone can confirm.\n>>\n>> 2.6.5 and prior (tested all the way back to 1.7.6, so this was\n>> consistent for a long time):\n>>\n>> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n>> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n>>\n>> 2.7.0:\n>>\n>> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n>> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n>>\n>> I've bisected this back to:\n>>\n>> bturner@ubuntu:~/Development/oss/git/git$ git bisect bad\n>> 9e468334b41c1d1fc715de177ef1f61a36c1cf01 is the first bad commit\n>> commit 9e468334b41c1d1fc715de177ef1f61a36c1cf01\n>> Author: Karthik Nayak <karthik.188@gmail.com>\n>> Date:   Fri Oct 30 14:15:28 2015 +0530\n>>\n>>     ref-filter: fallback on alphabetical comparison\n>>\n>> The message for that commit indicates that sorting numerics (which I\n>> assume is the implementation for committerdate) now falls back on\n>> alphabetical for identical values, suggesting this order change is\n>> actually intentional and correct.\n>\n> And also that the previous order was arbitrary (just letting the sort\n> algorithm chose which one to put first in case of equality on the main\n> sorting criterion), so the fact that it was stable previously is more\n> or less just luck. Now it should be stable.\n>\n>> Is that right?\n>>\n\nYup, absolutely.\n\n>> (Note: The alphabetical-ness of the branch names is reversed, which\n>> seems logical given my original sort was -committerdate. A\n>> --sort=refname looks like this.\n>>\n>> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n>> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/@#$% - >Tue Jan 3 17:00:51 2012 +1100\n>> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n>>\n>> That's probably more correct too.)\n>>\n>> Best regards,\n>> Bryan Turner\n\nThis is correct as per the patch, But I'm wondering if this is desired.\nI.E when sorting in reverse order should the fallback (alphabetical sort)\nalso be in reverse order?\n\n-- \nRegards,\nKarthik Nayak\n"},{"id":"275598","messageId":"56914AD2.9060303@kdbg.org","threadId":"41154","inReplyTo":"CAOLa=ZT7n8qCoS81iijf9vswWV+S8n7=4kmbKP0EAMnOenXwSg@mail.gmail.com","subject":"Re: for-each-ref output order change in 2.7.0","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-01-09T18:00:50Z","receivedAt":"2016-01-09T18:00:50Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 09.01.2016 um 18:21 schrieb Karthik Nayak:\n>>> (Note: The alphabetical-ness of the branch names is reversed, which\n>>> seems logical given my original sort was -committerdate. A\n>>> --sort=refname looks like this.\n>>>\n>>> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n>>> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n>>> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n>>> refs/heads/@#$% - >Tue Jan 3 17:00:51 2012 +1100\n>>> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n>>>\n>>> That's probably more correct too.)\n>>>\n>>> Best regards,\n>>> Bryan Turner\n>\n> This is correct as per the patch, But I'm wondering if this is desired.\n> I.E when sorting in reverse order should the fallback (alphabetical sort)\n> also be in reverse order?\n\nIMO, the fallback sorting should be in reverse order only when the user \nexplicitley asked for reverse order. Just because committer date implies \nsome \"reverse\" ordering should not imply that refs with the same \ncommitter date should also be listed in reverse alphabetical order.\n\n-- Hannes\n"},{"id":"275599","messageId":"CAOLa=ZTUcmAjpC4nf_o7ZAHC3Asj9iwfKOOrJr90_kAyMbd22A@mail.gmail.com","threadId":"41154","inReplyTo":"56914AD2.9060303@kdbg.org","subject":"Re: for-each-ref output order change in 2.7.0","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2016-01-09T21:29:22Z","receivedAt":"2016-01-09T21:29:22Z","isPatch":false,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"On Sat, Jan 9, 2016 at 11:30 PM, Johannes Sixt <j6t@kdbg.org> wrote:\n> Am 09.01.2016 um 18:21 schrieb Karthik Nayak:\n>>>>\n>>>> (Note: The alphabetical-ness of the branch names is reversed, which\n>>>> seems logical given my original sort was -committerdate. A\n>>>> --sort=refname looks like this.\n>>>>\n>>>> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n>>>> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n>>>> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n>>>> refs/heads/@#$% - >Tue Jan 3 17:00:51 2012 +1100\n>>>> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n>>>>\n>>>> That's probably more correct too.)\n>>>>\n>>>> Best regards,\n>>>> Bryan Turner\n>>\n>>\n>> This is correct as per the patch, But I'm wondering if this is desired.\n>> I.E when sorting in reverse order should the fallback (alphabetical sort)\n>> also be in reverse order?\n>\n>\n> IMO, the fallback sorting should be in reverse order only when the user\n> explicitley asked for reverse order. Just because committer date implies\n> some \"reverse\" ordering should not imply that refs with the same committer\n> date should also be listed in reverse alphabetical order.\n>\n> -- Hannes\n>\n\nI was thinking along the same lines. But do we want to expose the fallback to\nthe user (i.e let them choose if its reversible or not)? If not Its only a small\nchange required:\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex cc850b0..59d43d7 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1554,7 +1554,7 @@ static int cmp_ref_sorting(struct ref_sorting\n*s, struct ref_array_item *a, stru\n                if (va->ul < vb->ul)\n                        cmp = -1;\n                else if (va->ul == vb->ul)\n-                       cmp = strcmp(a->refname, b->refname);\n+                       return strcmp(a->refname, b->refname);\n                else\n                        cmp = 1;\n        }\n\nI could send a patch, as soon as we decide if we want to stick something\nsimple like this or expose the fallback sort to the user.\n\n-- \nRegards,\nKarthik Nayak\n"},{"id":"275607","messageId":"569229B8.9000009@kdbg.org","threadId":"41154","inReplyTo":"CAOLa=ZTUcmAjpC4nf_o7ZAHC3Asj9iwfKOOrJr90_kAyMbd22A@mail.gmail.com","subject":"Re: for-each-ref output order change in 2.7.0","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-01-10T09:51:52Z","receivedAt":"2016-01-10T09:51:52Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 09.01.2016 um 22:29 schrieb Karthik Nayak:\n> On Sat, Jan 9, 2016 at 11:30 PM, Johannes Sixt <j6t@kdbg.org> wrote:\n>> Am 09.01.2016 um 18:21 schrieb Karthik Nayak:\n>>>>>\n>>>>> (Note: The alphabetical-ness of the branch names is reversed, which\n>>>>> seems logical given my original sort was -committerdate. A\n>>>>> --sort=refname looks like this.\n\nAfter reading up on branch sorting, I notice that the single dash in \nfront of committerdate is not a typo, but a request to sort in reverse. \nTherefore, the resulting sort order, which was\n\nrefs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\nrefs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/@#$% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\nrefs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n\nis totally correct.\n\n>>>>>\n>>>>> refs/heads/!@#$% -> Tue Jan 3 17:00:51 2012 +1100\n>>>>> refs/heads/!@#% -> Tue Jan 3 17:04:06 2012 +1100\n>>>>> refs/heads/% -> Tue Jan 3 17:00:51 2012 +1100\n>>>>> refs/heads/@#$% - >Tue Jan 3 17:00:51 2012 +1100\n>>>>> refs/heads/@#% -> Tue Jan 3 17:00:51 2012 +1100\n>>>>>\n>>>>> That's probably more correct too.)\n\nBut I don't know what would be \"more\" correct here. It's simply correct.\n\n>>> This is correct as per the patch, But I'm wondering if this is desired.\n>>> I.E when sorting in reverse order should the fallback (alphabetical sort)\n>>> also be in reverse order?\n>>\n>>\n>> IMO, the fallback sorting should be in reverse order only when the user\n>> explicitley asked for reverse order. Just because committer date implies\n>> some \"reverse\" ordering should not imply that refs with the same committer\n>> date should also be listed in reverse alphabetical order.\n\nI was wrong here. Sorting by committerdate does not imply reverse-ness. \nI just did not know enough about the --sort options when I wrote this \nparagraph.\n\n>\n> I was thinking along the same lines. But do we want to expose the fallback to\n> the user (i.e let them choose if its reversible or not)?\n\nNo, we do not want to expose the fallback to the user. And as far as I \ncan see, no further change is required.\n\n-- Hannes\n"}]}