fix: ignore extensions for directories when sorting
Before this patch:
$ mkdir test1 test2 abc 01.city 02.apple
$ touch a.txt abc.txt abc.mp3 ab
$ eza
01.city 02.apple a.txt ab abc abc.mp3 abc.txt test1 test2
$ eza --sort=extension
ab abc test1 test2 02.apple 01.city abc.mp3 a.txt abc.txt
$ eza --sort=extension --group-directories-first
abc test1 test2 02.apple 01.city ab abc.mp3 a.txt abc.txt
Note how 01.city is sorted after 02.apple when sorting by extension.
After patch:
$ eza --sort=extension
01.city 02.apple ab abc test1 test2 abc.mp3 a.txt abc.txt
$ eza --sort=extension --group-directories-first
01.city 02.apple abc test1 test2 ab abc.mp3 a.txt abc.txt
Directories are treated exactly as if there are no . was found in the name.
Closes #821
Hum now that I think of it, it would be great to have some tests for this behavior.
You can take https://github.com/eza-community/eza/commit/570b9772584d715f2f3b83ec2e29fef83a3093d2, add it to this PR and see if it works in the CI.
Thanks. Looks like more tests need to be updated?
Hum yeah, you would need to regen test (see here) and for that you need Nix. Otherwise, I or @cafkafk could regen the broken tests ourselves.
Otherwise, I or @cafkafk could regen the broken tests ourselves.
Would appreciate it!
Hey thanks for the pr, this is indeed a slight issue !!
@cafkafk could you give this another look?
Would be nice to get this into a release and help me remove my local nix override.
Not sure what the next steps are to get this merged.
Well, we’d have to wait for @cafkafk to be available to review that but idk when that’ll be :sob:
Hi all. I seemed to have missed the latest comment by @cafkafk (no Github email?).
Anyway I have cherry picked my change to the latest main. I tried following the instructions to regenerate the tests. However, running powertest does not result in any change.
@ariasuni /@cafkafk: can you help regenerate the tests and get this finally merged?
Hey, you can:
- install Nix and start it with
sudo systemctl start nix-daemonor similar (I think you should enable Nix flakes also) - install
just - install powertest with:
git clone https://github.com/eza-community/powertest
cd powertest
cargo install --path . --locked
- then I think you need to use
just idumpor something other command in thejustfile
Otherwise somebody else has to do these steps (maybe I can do it in a few days…).