-
-
Notifications
You must be signed in to change notification settings - Fork 387
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
Add flexibility when dealing with index entries #325
Conversation
There is something Travis does not like. Otherwise this is good to me (the inline comments are not blockers). |
That Travis error is pretty odd... looks like it might be due to different unittest versions. I'll work around that. |
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.
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 |
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.
I had seen that error, but chalked it up to a messed-up local setup. Third time's the charm, though |
Let
IndexEntry
instances 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.