-
Notifications
You must be signed in to change notification settings - Fork 2.5k
git_index_read_index
fixes
#3808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Read a tree into an index using `git_index_read_index` (by reading a tree into a new index, then reading that index into the current index), then write the index back out, ensuring that our new index is treesame to the tree that we read.
Clear any error state upon each iteration. If one of the iterations ends (with an error of `GIT_ITEROVER`) we need to reset that error to 0, lest we stop the whole process prematurely.
Treat index entries with different modes as different, which they are, at least for the purposes of up-to-date calculations.
Update the flags to reset the path_len (to emulate `index_insert`)
Read a tree into an index, write the index, then re-open the index and ensure that we are treesame to the original.
Test a rebase (both a merge rebase and an inmemory rebase) with a new commit that adds files underneath a new subfolder.
When adding a new entry to an existing index via `git_index_read_index`, be sure to remove the tree cache entry for that new path. This will mark all parent trees as dirty.
23b205f
to
46082c3
Compare
Note that I also pulled in the tests from libgit2/rugged#609 /cc @arthurschreiber |
These changes are quite safe and nicely contained to |
Thank you so much! ❤️ I'm really excited to test drive this! 😄 |
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.
Some fixes to
git_index_read_index
, which replaces an the contents of one index with another. (But doing so intelligently - so that if the destination index already has a stat cache for some files, those will be maintained if the new index being read has not updated those files.)There are two important fixes here:
GIT_ITEROVER
on one of the iterators and we must clear that upon each step, otherwise we may hit a branch that does not updateerror
. (In particular, when there is nodup_entry
oradd_entry
, but there is aremove_entry
, we may not clear theGIT_ITEROVER
.)Two minor correctness fixes that are important for indexes that will get persisted to disk:
flags
that will be persisted as the on disk path length when duplicating an entry. This is generally done duringgit_index_add
and friends, but during the merge into the new index, we should insist upon its existence.