Repository navigation
fix(ls): preserve per-directory headers for multiple directory operands - #2868
Closed
Sammy-Dabbas wants to merge 1 commit into
Closed
Sammy-Dabbas wants to merge 1 commit into
Sammy-Dabbas wants to merge 1 commit into
Conversation
compact_ls fed every line through the date-anchored parse_ls_line, which returns None for the path headers native ls prints with multiple operands, silently dropping them and pooling all entries into one flat list. Split the raw output into per-directory sections and render each under its header, matching native ls shape. Single directory output is unchanged and pinned by an exact-string test. Closes rtk-ai#2857
Collaborator
|
Closing in favour of #2865, which closes the same issue #2857 with the same per directory header behaviour and applies to the compact_ls that is on develop today. This branch is built on the older three value compact_ls, so merging it would take back out the hidden entry disclosure that has since landed. Review and comments are very welcome on #2865, or reply here if your section splitting covers something it misses. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rtk ls dirA dirBflattened every directory's entries into one list with no per directory attribution, so a file could appear to belong to the wrong directory. Nativelsprints adirA:header before each directory's listing. The rawls -laoutput rtk gets does contain the headers;compact_lsdropped them because every line goes through the date anchoredparse_ls_line, which returnsNonefor header lines.Closes #2857
Summary
lsoutput intopath:sections and render each directory's entries under its header (blank line between groups), only when native ls printed headers-Rheaders are fixed by the same mechanism-Rcase of Some filters drop or misrepresent requested data (find, ls -R, env, cargo label) #2271 (this mirrors its helper conventions); it has been conflicting for a month, so this is a standalone fix for the multi-operand case. Happy to rebase if fix: keep filter output faithful for find, ls -R, env, and cargo #2272 merges first.Test plan
cargo fmt --all && cargo clippy --all-targets && cargo testrtk <command>output inspectedReproduced the flat output on develop, confirmed the fixed output matches native ls shape, and added 3 multi-directory regression tests (32/32 ls tests pass). Full suite green apart from 2 pre-existing
hooks::rewrite_cmdenvironment failures, verified identical on pristine develop.