eza icon indicating copy to clipboard operation
eza copied to clipboard

fix: ignore extensions for directories when sorting

Open sdht0 opened this issue 10 months ago • 9 comments

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

sdht0 avatar Mar 14 '25 15:03 sdht0

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.

ariasuni avatar Apr 19 '25 00:04 ariasuni

Thanks. Looks like more tests need to be updated?

sdht0 avatar May 03 '25 15:05 sdht0

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.

ariasuni avatar May 14 '25 15:05 ariasuni

Otherwise, I or @cafkafk could regen the broken tests ourselves.

Would appreciate it!

sdht0 avatar May 14 '25 15:05 sdht0

Hey thanks for the pr, this is indeed a slight issue !!

MartinFillon avatar May 19 '25 07:05 MartinFillon

@cafkafk could you give this another look?

Would be nice to get this into a release and help me remove my local nix override.

sdht0 avatar May 30 '25 17:05 sdht0

Not sure what the next steps are to get this merged.

sdht0 avatar Jun 20 '25 15:06 sdht0

Well, we’d have to wait for @cafkafk to be available to review that but idk when that’ll be :sob:

ariasuni avatar Jun 20 '25 21:06 ariasuni

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?

sdht0 avatar Oct 05 '25 15:10 sdht0

Hey, you can:

  • install Nix and start it with sudo systemctl start nix-daemon or 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 idump or something other command in the justfile

Otherwise somebody else has to do these steps (maybe I can do it in a few days…).

ariasuni avatar Nov 28 '25 17:11 ariasuni