Add flexibility when dealing with index entries#325
Merged
jdavid merged 5 commits intolibgit2:masterfrom Jan 29, 2014
Merged
Conversation
Member
|
There is something Travis does not like. Otherwise this is good to me (the inline comments are not blockers). |
Member
Author
|
That Travis error is pretty odd... looks like it might be due to different unittest versions. I'll work around that. |
Member
|
There are two different errors actually:
|
The tree entries exist more or less independently of the index they were retrieved from. The idea behind them is that they can be kept by a binding without needing to refer to the original anymore, which may disappear at any moment if the index is modified. Keep a copy of the data in TreeEntry instead of pointing to the one retrieved from the index, which is not safe to keep around.
They are not required to belong to a particular index, so it should be possible to create them at runtime in order to insert them.
Member
Author
|
Oh, I see; Ok, both of those things have been solved, I'll take a look at type-checking. I think I did at some point, but you'd need to check for both |
Member
|
Travis still failing, with another error. The improved input handling can wait for another PR. |
When updating entries in an index, it is necessary to modify the attributes of tree entries. make it possible to do so.
A path is only useful if we have the file on the worktree. Passing an IndexEntry allows us to add an entry with arbitrary attributes.
Take an optional repository in Index.write_tree() to serialize to a tree into a particular repository's odb.
Member
Author
|
I had seen that error, but chalked it up to a messed-up local setup. Third time's the charm, though |
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.
Let
IndexEntryinstances live independent of their original index and bring some memory safety. Move to get an own copy of each instead of pointing to the copy inside the index, which we cannot trust to keep existing.Allow creation of IndexEntry instances, which we need in order to make working with bare repositories more comfortable.