libgit2/libgit2 — pull request #448 by nulltoken (2011-10-09 16:52:51+00:00)
Title: Tree entry random access

Convenience method to help with direct retrieval of the oid of a tree entry, provided the user knows the relative path to the tree entry.

```c
+ /* Similarly to git_tree_entry_byname(), one can use a plain name... */
+ must_pass(git_tree_entry_oid_from_path(&id_out, tree, "README"));
+ must_pass(assert_oid(&id_out, "1385f264afb75a56a5bec74243be9b367ba4ca08"));

/* ...or a path to retrieve a tree entry. Either a Blob... */
must_pass(git_tree_entry_oid_from_path(&id_out, tree, "ab/de/fgh/1.txt"));
must_pass(assert_oid(&id_out, "1f67fc4386b2d171e0d21be1c447e12660561f9b"));

/* ...or a Tree. */
must_pass(git_tree_entry_oid_from_path(&id_out, tree, "ab/de"));
must_pass(assert_oid(&id_out, "b6361fc6a97178d8fc8639fdeed71c775ab52593"));

/* Will fail if any segment of the path is not a valid tree entry */
must_be_true(git_tree_entry_oid_from_path(&id_out, tree, "ab/de/fgh/i-do-not-exist.txt") == GIT_ENOTFOUND);
must_be_true(git_tree_entry_oid_from_path(&id_out, tree, "ab/me-neither/fgh/2.txt") == GIT_ENOTFOUND);
```