git_index_read_index fixes
#3808
Merged
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_ITEROVERon 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_entryoradd_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:
flagsthat will be persisted as the on disk path length when duplicating an entry. This is generally done duringgit_index_addand friends, but during the merge into the new index, we should insist upon its existence.