Skip to content

fix(ls): preserve per-directory headers for multiple directory operands - #2868

Closed
Sammy-Dabbas wants to merge 1 commit into
rtk-ai:developfrom
Sammy-Dabbas:fix/ls-multi-dir-headers
Closed

Sammy-Dabbas wants to merge 1 commit into
rtk-ai:developfrom
Sammy-Dabbas:fix/ls-multi-dir-headers

Conversation

@Sammy-Dabbas

Copy link
Copy Markdown

rtk ls dirA dirB flattened every directory's entries into one list with no per directory attribution, so a file could appear to belong to the wrong directory. Native ls prints a dirA: header before each directory's listing. The raw ls -la output rtk gets does contain the headers; compact_ls dropped them because every line goes through the date anchored parse_ls_line, which returns None for header lines.

Closes #2857

Summary

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

Reproduced 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_cmd environment failures, verified identical on pristine develop.

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
@CLAassistant

CLAassistant commented Jul 7, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@KuSh

KuSh commented Sep 19, 2026

Copy link
Copy Markdown
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.

@KuSh KuSh closed this Sep 19, 2026
@KuSh KuSh added the duplicate This issue or pull request already exists label Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk ls with multiple directory arguments omits per-directory headers

3 participants