Repository navigation
Conversation
The prior code copied the repository index without its cache. This results in unnecessary rehashing
Checking for changes resulted in a full status, essentially repeating later HEAD-to-index and index-to-workdir diffs. In most cases this can be avoided by using the diffs up front. Add regression tests for corner cases this code touches, namely untracked and ignored files.
Limit the reset and untracked files being stashed to the given paths. Previously stashing paths would reset index and working tree to HEAD, losing unstashed changes.
Previously, the reset would walk the entire tree again. This can be limited to the paths being stashed if untracked or ignored files aren't being removed.
This branch has not been deployed
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.
This PR is split over 5 commits and is a mixture of performance fixing and error fixing related to
git_stash_save.commit_worktreewhere errors were treated as successcommit_worktreebuild_workdir_treetogit_stash_save_with_opts, and reuses them inensure_there_are_changes_to_stashArguably the non-performance related fixes could be isolated in separate PRs, but my primary motivation here was to speed up the stashing.
The resulting speed-up in the Linux repo: stashing one modified file goes from 1.44s and 3 working tree walks to 0.58s and 1 working tree walk. For comparison,
git stashis 0.62s.Finally, worth noting that the test code is predominantly AI generated.