-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command list does not always sort the entries correctly #54
Comments
Verified on macOS: $ adr version
Version 3.2.3
$ mkdir /tmp/test && cd "$_"
$ adr init
Creating ADR directory at /private/tmp/test/doc/adr
$ adr new a
Creating ADR
Created ADR at /private/tmp/test/doc/adr/0002-a.md
Opening Editor on /private/tmp/test/doc/adr/0002-a.md ...
/private/tmp/test/doc/adr/0002-a.md
$ adr new b
Creating ADR
Created ADR at /private/tmp/test/doc/adr/0003-b.md
Opening Editor on /private/tmp/test/doc/adr/0003-b.md ...
$ adr new c
Creating ADR
Created ADR at /private/tmp/test/doc/adr/0004-c.md
Opening Editor on /private/tmp/test/doc/adr/0004-c.md ...
/private/tmp/test/doc/adr/0004-c.md
$ adr list
0001-record-architecture-decisions.md
0002-a.md
0004-c.md
0003-b.md |
$ jshell --feedback=silent - <<< 'Files.list(Path.of("doc", "adr")).forEachOrdered(System.out::println)'
doc/adr/0001-record-architecture-decisions.md
doc/adr/0002-a.md
doc/adr/0004-c.md
doc/adr/0003-b.md
$ jshell --feedback=silent - <<< 'Files.list(Path.of("doc", "adr")).map(Path::getFileName).forEachOrdered(System.out::println)'
0001-record-architecture-decisions.md
0002-a.md
0004-c.md
0003-b.md
$ jshell --feedback=silent - <<< 'Files.list(Path.of("doc", "adr")).map(Path::getFileName).sorted().forEach(System.out::println)'
0001-record-architecture-decisions.md
0002-a.md
0003-b.md
0004-c.md
FileSystemProvider#newDirectoryStream does not specify the order of the directory entries in the stream.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Stream.html#sorted() |
Thanks for figuring this out. I'll change the code to use |
I've changed to code as suggested and pushed it to the main branch. Still not released as yet. |
Reviewed the code but have not verified runtime behavior—hope to have time this weekend. |
Kein Stress |
Verified 9a2e0a2 with macOS 12.7.6. |
Thanks. I'm closing the issue. |
As noticed here
adr list
does not always sort the entries correctly although a sort is explicity called in the code (seeCommandList.java
)The text was updated successfully, but these errors were encountered: