Optimize rebase/squash rewrite performance and expand regression coverage#515
Open
svarlamov wants to merge 3 commits intofeat/corehooksfrom
Open
Optimize rebase/squash rewrite performance and expand regression coverage#515svarlamov wants to merge 3 commits intofeat/corehooksfrom
svarlamov wants to merge 3 commits intofeat/corehooksfrom
Conversation
3864488 to
313ae9f
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.
Summary
This PR substantially reduces
git-aioverhead for rewrite workflows (rebase,merge --squash, and related post-commit paths), while tightening correctness with targeted regression tests.The work is focused on first-principles performance improvements:
Problem
In large repos and rewrite-heavy flows (Graphite stacks, large generated diffs, long commit ranges), rewrite-related operations were dominated by:
This led to multi-minute stalls in real rebase/squash scenarios.
Design/Approach
1) Shrink worksets to AI-relevant + staged/changed paths
merge --squashinstead of broad branch diffs.2) Batch git object reads
git cat-file --batch:Repository::get_files_content_at_commitRepository::get_all_staged_files_content3) Fast-paths for no-op / metadata-only scenarios
4) Avoid unnecessary heavy attribution/materialization
VirtualAttributionsnow supports line-only/initial-only loaders for post-commit paths:from_just_working_log_line_onlyfrom_initial_only_line_only5) Squash pre-commit checkpoint skip handshake
Correctness & Semantics
Key invariant preserved:
Notable fix included:
Test Coverage Added
New edge/regression tests cover:
VirtualAttributionsinitial-only and message-clear behavior,Representative test additions:
src/commands/checkpoint.rssrc/git/repo_storage.rssrc/authorship/post_commit.rssrc/authorship/rebase_authorship.rssrc/authorship/virtual_attribution.rssrc/git/authorship_traversal.rssrc/git/repository.rsBench/Diagnostics
scripts/benchmarks/git/benchmark_nasty_squashes.shValidation
Ran full suite successfully:
cargo test -- --test-threads=1No test failures.
Scope
Primary touched areas:
rebase_authorship, squash prep/rewrite)