Skip to content

ls: implement --group-directories-first#3550

Merged
sylvestre merged 4 commits intouutils:mainfrom
thomasqueirozb:ls_gds
May 22, 2022
Merged

ls: implement --group-directories-first#3550
sylvestre merged 4 commits intouutils:mainfrom
thomasqueirozb:ls_gds

Conversation

@thomasqueirozb
Copy link
Copy Markdown
Contributor

Closes #3519

@sylvestre
Copy link
Copy Markdown
Contributor

Cool stuff. Could you please add tests? thanks

@thomasqueirozb
Copy link
Copy Markdown
Contributor Author

thomasqueirozb commented May 21, 2022

Cool stuff. Could you please add tests? thanks

I did it but I went down a rabbit hole. I found out that ls -a doesn't work the same as the GNU version. The . and .. directories are always first, no matter what. If sorts are applied, -r is specified or --group-directories-first is used, the location of . and .. shouldn't always be on the top.

Now with the changes I made it mostly behaves the same (I think). But this created one unfortunate side effect: ls -a1v now places .. at the end of the list and . at the beginning. The GNU version places both . and .. at the beginning. I couldn't find an easy fix for this so I just changed the test.

@sylvestre
Copy link
Copy Markdown
Contributor

I went down a rabbit hole.

Welcome to the Rust/coreutils ;)

@thomasqueirozb
Copy link
Copy Markdown
Contributor Author

An unrelated test failed. Maybe re-run that step of the CI?

@sylvestre
Copy link
Copy Markdown
Contributor

bravo
Warning: Congrats! The gnu test tests/ls/group-dirs is no longer failing!

@sylvestre sylvestre merged commit 887f49c into uutils:main May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement ls --group-directories-first

2 participants