fix(core): stop labelling unclassified git statuses as clean - #863
fix(core): stop labelling unclassified git statuses as clean#863kevin9327 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe Git status formatter now reports ChangesGit status classification
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to Git status output now correctly reports unclassified states as unknown rather than clean, with existing recognized status labels preserved. No current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The defect
A merge-conflicted file is reported as
clean.format_git_status_optends with:GIT_STATUS_CURRENTis0in libgit2, sogit2::Status::CURRENTis the emptybitflag and
status.contains(Status::CURRENT)is vacuously true for everystatus. Every state the chain does not name explicitly therefore falls out as
clean, and theelse { None }arm — plusformat_git_status'sunwrap_or("unknown")— is unreachable.The states that hit it:
CONFLICTED,WT_TYPECHANGE,INDEX_TYPECHANGE,INDEX_RENAMED.CONFLICTEDgenuinely reaches this function:fuzz_git_watcher_stress.rsalready asserts "picker must surface CONFLICTED after merge". So after a
conflicted merge the picker shows those files as clean, and since #845 the MCP
output drops the annotation entirely rather than flagging anything.
The Lua layer is already set up for the fallback —
GIT_LABELSinlua/fff/file_picker/file_info.luacarriesunknown = '?', a label the Rustside could never produce.
The fix
Test
is_empty()and let anything else fall through to the existingunknownfallback, as the code was written to do.
Verification (Windows, default
ripgrepfeatures)RUSTUP_TOOLCHAINwas pinned to1.98.0-x86_64-pc-windows-msvcbecauserust-toolchain.toml'sstablechannel could not update on this machine.Before,
cargo test -p fff-search --lib -- git:::After:
The same test pins every label that must not move —
None,Status::empty()and
Status::CURRENTall still readclean, anduntracked/modified/staged_modified/ignoredare unchanged. Those assertions pass both beforeand after, so only the previously-misfiled states move.
cargo test -p fff-search --lib— 160 passed, 0 failed.cargo test -p fff-mcp --bins— 22 passed, 0 failed (coverssuffix_omits_clean_git_statusandsuffix_keeps_dirty_git_status).cargo fmt --all -- --check— clean.Summary by CodeRabbit