Skip to content

perf(git): single porcelain status via git-dir state detection#3004

Open
iagogfe wants to merge 1 commit into
rtk-ai:developfrom
iagogfe:perf/git-status-single-porcelain
Open

perf(git): single porcelain status via git-dir state detection#3004
iagogfe wants to merge 1 commit into
rtk-ai:developfrom
iagogfe:perf/git-status-single-porcelain

Conversation

@iagogfe

@iagogfe iagogfe commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • Avoid a second plain git status on the compact path (hot path for rtk git status)
  • Recover detached HEAD and in-progress state (rebase/merge/cherry-pick/revert/bisect/am/sparse) from git-dir marker files and porcelain unmerged codes
  • Measured ~30% faster wall time for rtk git status (eliminating the dual-spawn was the main cost)

Test plan

  • cargo fmt --all --check && cargo clippy --all-targets && cargo test
  • Manual testing: rtk git status output inspected
  • Unit tests for prose parsers kept under #[cfg(test)]; git module tests pass
  • Perf (local, Linux x86_64, release build, hyperfine --shell=none, 80 runs):
    • before (dual git status): ~15.8 ms mean
    • after (single porcelain + git-dir state): ~10.9 ms mean
    • ~1.45× faster (~5 ms absolute) on this machine — not a universal guarantee

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

Avoid a second plain `git status` on the compact path. Recover detached
HEAD and in-progress state (rebase/merge/cherry-pick/etc.) from git-dir
marker files and porcelain unmerged codes instead.
@CLAassistant

CLAassistant commented Jul 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@tapheret2 tapheret2 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: perf(git): single porcelain status via git-dir state detection

Files: src/cmds/git/git.rs
Size: +211 / -24

Notes

  • Static pass on the patch: no obvious blockers from the diff alone.

Thanks @iagogfe — independent review on the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants