File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,13 @@ func (t Tree) EntryByName(filename string) *TreeEntry {
52
52
defer C .free (unsafe .Pointer (cname ))
53
53
54
54
entry := C .git_tree_entry_byname (t .cast_ptr , cname )
55
- runtime .KeepAlive (t )
56
55
if entry == nil {
57
56
return nil
58
57
}
59
58
60
- return newTreeEntry (entry )
59
+ goEntry := newTreeEntry (entry )
60
+ runtime .KeepAlive (t )
61
+ return goEntry
61
62
}
62
63
63
64
// EntryById performs a lookup for a tree entry with the given SHA value.
@@ -71,13 +72,14 @@ func (t Tree) EntryById(id *Oid) *TreeEntry {
71
72
defer runtime .UnlockOSThread ()
72
73
73
74
entry := C .git_tree_entry_byid (t .cast_ptr , id .toC ())
74
- runtime .KeepAlive (t )
75
75
runtime .KeepAlive (id )
76
76
if entry == nil {
77
77
return nil
78
78
}
79
79
80
- return newTreeEntry (entry )
80
+ goEntry := newTreeEntry (entry )
81
+ runtime .KeepAlive (t )
82
+ return goEntry
81
83
}
82
84
83
85
// EntryByPath looks up an entry by its full path, recursing into
@@ -102,12 +104,13 @@ func (t Tree) EntryByPath(path string) (*TreeEntry, error) {
102
104
103
105
func (t Tree ) EntryByIndex (index uint64 ) * TreeEntry {
104
106
entry := C .git_tree_entry_byindex (t .cast_ptr , C .size_t (index ))
105
- runtime .KeepAlive (t )
106
107
if entry == nil {
107
108
return nil
108
109
}
109
110
110
- return newTreeEntry (entry )
111
+ goEntry := newTreeEntry (entry )
112
+ runtime .KeepAlive (t )
113
+ return goEntry
111
114
}
112
115
113
116
func (t Tree ) EntryCount () uint64 {
You can’t perform that action at this time.
0 commit comments