EntryByPath looks up an entry by its full path, recursing into deeper trees if necessary (i.e. if there are slashes in the path)
(path string)
| 87 | // EntryByPath looks up an entry by its full path, recursing into |
| 88 | // deeper trees if necessary (i.e. if there are slashes in the path) |
| 89 | func (t *Tree) EntryByPath(path string) (*TreeEntry, error) { |
| 90 | cpath := C.CString(path) |
| 91 | defer C.free(unsafe.Pointer(cpath)) |
| 92 | var entry *C.git_tree_entry |
| 93 | |
| 94 | runtime.LockOSThread() |
| 95 | defer runtime.UnlockOSThread() |
| 96 | |
| 97 | ret := C.git_tree_entry_bypath(&entry, t.cast_ptr, cpath) |
| 98 | runtime.KeepAlive(t) |
| 99 | if ret < 0 { |
| 100 | return nil, MakeGitError(ret) |
| 101 | } |
| 102 | defer C.git_tree_entry_free(entry) |
| 103 | |
| 104 | return newTreeEntry(entry), nil |
| 105 | } |
| 106 | |
| 107 | func (t *Tree) EntryByIndex(index uint64) *TreeEntry { |
| 108 | entry := C.git_tree_entry_byindex(t.cast_ptr, C.size_t(index)) |