Ejemplo n.º 1
0
func (tree *Tree) EntryByName(name string) *TreeEntry {
	entry := new(TreeEntry)
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	entry.git_tree_entry = C.git_tree_entry_byname(tree.git_tree, cname)
	return entry
}
Ejemplo n.º 2
0
func (t *Tree) EntryByName(filename string) (*Entry, error) {
	entry := new(Entry)
	entry.git_tree_entry = C.git_tree_entry_byname(t.git_tree, C.CString(filename))
	if entry.git_tree_entry == nil {
		return nil, errors.New("Unable to find entry.")
	}
	return entry, nil
}
Ejemplo n.º 3
0
func (t Tree) EntryByName(filename string) *TreeEntry {
	cname := C.CString(filename)
	defer C.free(unsafe.Pointer(cname))

	entry := C.git_tree_entry_byname(t.cast_ptr, cname)
	if entry == nil {
		return nil
	}

	return newTreeEntry(entry)
}