fix(ls): respect sorting when grouping directories; disambiguate size sorting properly#12109
Conversation
|
GNU testsuite comparison: |
|
Can you please add a test to ensure we don't regress in the future? |
This comment was marked as resolved.
This comment was marked as resolved.
It is because we do it for the first time on the buffer and only once; there stability doesn't matter. Let me add a test real quick. |
This comment was marked as outdated.
This comment was marked as outdated.
|
That should be it. I had to also fix the size checking in order to get the new tests to pass (and that wasn't my fault LOL). |
|
Thanks! |
| Sort::Time => entries.sort_unstable_by_key(|k| { | ||
| Reverse( | ||
| k.metadata() | ||
| .and_then(|md| metadata_get_time(md, config.time)) | ||
| .unwrap_or(UNIX_EPOCH), | ||
| ) | ||
| }), |
There was a problem hiding this comment.
So sorting by time will also put equivalently-timestamped entries in random order?
There was a problem hiding this comment.
We could also disambiguate those by name, yeah. Kinda surprising we previously left it in the order std gave it to us, although I have to say that this is essentially impossible outside fabricated scenarios or no{a, c, m}time filesystems. I'll look into it as well.
There was a problem hiding this comment.
I was raised on filesystems that only tracked one timestamp field and on software whose all files, at normal conditions, had a modification date/time of 1992-03-10 03:10:00. I know fabricated scenarios to be a fact of life, not a remote possibility.
Fixes #11997.