fix(git): wire up status_max_files and status_max_untracked config limits#2459
Open
molloyzak13 wants to merge 1 commit into
Open
fix(git): wire up status_max_files and status_max_untracked config limits#2459molloyzak13 wants to merge 1 commit into
molloyzak13 wants to merge 1 commit into
Conversation
|
|
…mits format_status_inner now accepts an optional LimitsConfig. When limits are provided, tracked files (staged/modified) and untracked files are counted separately and capped at their respective config knobs. The unbounded path is preserved for backward compatibility with existing tests and callers. Closes rtk-ai#2437
afd6b8b to
d2f3af5
Compare
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.
git statushas two user-configurable knobs inLimitsConfig—status_max_filesandstatus_max_untracked— that have serde defaults and are documented insrc/core/README.md, but no code ever reads them. The porcelain status formatter iterates every line without any cap, so settingstatus_max_files = 2inconfig.tomlis a silent no-op.The root cause is that
format_status_innerwas refactored to a straightforward porcelain-lines iterator when the compact-status rewrite landed, and the cap logic was never ported across. The fields sat orphaned inconfig.rsever since.This wires them up.
format_status_innernow accepts an optionalLimitsConfig. When limits are provided (fromrun_statusviaconfig::limits()), tracked files and untracked files are counted separately and capped at their respective limits, with a"... +N more"hint appended when files are hidden. When no limits are passed, the existing unbounded path runs unchanged, so all existing tests pass without modification.The public
format_status_outputandformat_status_output_detachedwrappers continue to work unbounded for backward compatibility. The only production caller that gets limits isrun_status, which is the actualrtk git statusexecution path.Verified with
cargo test: 2194 passed, 0 related failures (1 pre-existing sandbox infra failure ontest_tool_exists_finds_git), all 8test_format_status_output_*tests pass, all 252 git-module tests pass.cargo checkis clean.