libgit2/libgit2sharp — pull request #547 by dahlbyk (2013-11-04 02:51:13+00:00)
Title: Publicize TreeEntryDefinition.From() overloads

Branched from #511. As written there:

My desired behavior was essentially "inject cleansed file from a branch" into earlier trees. Without `TreeEntryDefinition.From(te)`, I have to do something like:

```csharp
var blob = (Blob)te.Target;
td.Add(te.Path, blob, blob.Mode);
```

Not a huge deal, but I resent the extra work. Things would get even more complicated if you're dealing with more than one type of `TreeEntry`.

The first commit has the two overloads I think we definitely need:

* `From(TreeEntry treeEntry)` for the case above, where we just want to use an existing `TreeEntry`.
* `From(ObjectId objectId)` since we can't naturally get access to a `Submodule` instance during a rewrite.

The second commit includes the other two overloads, for completeness. I can't think of a reason we would _need_ to publicize either, since they align with existing `TreeDefinition.Add(...)` overloads, but I'm not sure it hurts to expose them if the others are too.