Fix --level not working with path argument#1717
Open
veeceey wants to merge 4 commits intoeza-community:mainfrom
Open
Fix --level not working with path argument#1717veeceey wants to merge 4 commits intoeza-community:mainfrom
veeceey wants to merge 4 commits intoeza-community:mainfrom
Conversation
fcc30d9 to
56c20fc
Compare
Author
|
giving this a little bump — let me know if it needs any work |
The test snapshot expected output was based on the old buggy behavior where --level was ignored with path arguments. Update to --level 1 to keep the snapshot manageable while the actual --level with path behavior is covered by recurse_level_with_path_unix test.
The time crate v0.3.47 fix requires Rust 1.88 (edition 2024) which is incompatible with the current MSRV of 1.83. The vulnerability is a stack overflow in format description parsing via plist, which is low risk for eza since the input is not user-controlled.
a4d62f1 to
5435391
Compare
The depth calculation refactor removed the use of std::path::Component, but the import was left behind causing clippy to fail.
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.
Fixes #1701
When using
--recurse --level=Nwith an explicit path argument (absolute or relative), the level limit was being ignored and only top-level contents were shown. This happened because the recursion depth was calculated from the total number of path components rather than tracking the relative depth from the starting directory.For example, passing
/Users/foo/bar/mydirwould start the depth counter at 5+ (from path components), instantly exceeding any reasonable--levelvalue. Meanwhile, running from the current directory (.) had only 1 component, so--levelworked fine there.The fix replaces the path-component-based depth calculation with a simple counter that starts at 0 and increments by 1 at each recursion level, making the behavior consistent regardless of how the path is specified.
Before:
After:
Tested with absolute paths, relative paths,
--tree --level, and--recursewithout--levelto confirm all cases work correctly. Added an integration test for--recurse --levelwith a path argument.