Skip to content

Cache git status in cl_stage and cl_commit#40

Merged
BHFock merged 2 commits intomainfrom
optimise-git-status-calls
Apr 16, 2026
Merged

Cache git status in cl_stage and cl_commit#40
BHFock merged 2 commits intomainfrom
optimise-git-status-calls

Conversation

@BHFock
Copy link
Copy Markdown
Owner

@BHFock BHFock commented Apr 16, 2026

Previously, cl_stage and cl_commit called clutil_is_file_untracked once per file in the changelist, each time shelling out to git status. For a changelist of N files in a working tree with R files, this scaled as O(N × R) — noticeable on large repos.

Add clutil_is_file_untracked_cached, which takes a precomputed status map. Update cl_stage and cl_commit to fetch the status map once at the top and look up per-file status from the cached dict. Behaviour is unchanged; cl_unstage already used this pattern.

BHFock added 2 commits April 16, 2026 21:32
Previously, cl_stage and cl_commit called clutil_is_file_untracked
once per file in the changelist, each time shelling out to git status.
For a changelist of N files in a working tree with R files, this
scaled as O(N × R) — noticeable on large repos.

Add clutil_is_file_untracked_cached, which takes a precomputed
status map. Update cl_stage and cl_commit to fetch the status map
once at the top and look up per-file status from the cached dict.
Behaviour is unchanged; cl_unstage already used this pattern.
@BHFock BHFock merged commit d3161fb into main Apr 16, 2026
4 checks passed
@BHFock BHFock deleted the optimise-git-status-calls branch April 16, 2026 19:46
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.

1 participant