You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
range-diff: add early size check to prevent long delays
When range-diff is given very large ranges (e.g., 250,000+ commits),
it takes an extremely long time in read_patches() before eventually
hitting memory or overflow issues. This provides a poor user experience
as the command appears to hang.
Add an early size check using 'git rev-list --count' to quickly count
commits in both ranges before attempting to read all patches. This
check typically completes in ~1 second even for ranges with hundreds
of thousands of commits, compared to read_patches() which times out
after many seconds.
The limit of 10,000 total commits is generous for real-world use cases
(even large refactoring series rarely exceed 1,000 commits) while
preventing impractical operations that would require gigabytes of memory
for the cost matrix.
When the limit is exceeded, range-diff now immediately returns a clear
error message rather than appearing to hang. The existing check in
get_correspondences() is retained as defense in depth.
This improves the user experience from:
- Wait 5+ seconds (or longer) for read_patches() to process
- Eventually crash or hang
To:
- Get an immediate error message in ~1 second
- Clear explanation of the problem
Signed-off-by: Paulo Casaretto <[email protected]>
Signed-off-by: pcasaretto <[email protected]>
0 commit comments