aboutsummaryrefslogtreecommitdiffstats
path: root/cshared/tree_cshared.go
blob: 8533f604ee772a07aecbf78d33cbc31c1a01770d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// Created by cgo - DO NOT EDIT

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:2
package main

/*
//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:5

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:4
import (
//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:7
	"gopkg.in/src-d/go-git.v4"
	"gopkg.in/src-d/go-git.v4/plumbing"
)

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:13

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:12
func c_Tree_get_Entries_len(t uint64) int {
	obj, ok := GetObject(Handle(t))
	if !ok {
		return 0
	}
	tree := obj.(*git.Tree)
	return len(tree.Entries)
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:23

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:22
func c_Tree_get_Entries_item(t uint64, index int) (*_Ctype_char, uint32, *_Ctype_char) {
	obj, ok := GetObject(Handle(t))
	if !ok {
		return nil, 0, nil
	}
	tree := obj.(*git.Tree)
	item := tree.Entries[index]
	return _Cfunc_CString(item.Name), uint32(item.Mode), CBytes(item.Hash[:])
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:34

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:33
func c_Tree_get_Hash(t uint64) *_Ctype_char {
	obj, ok := GetObject(Handle(t))
	if !ok {
		return nil
	}
	tree := obj.(*git.Tree)
	return CBytes(tree.Hash[:])
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:44

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:43
func c_Tree_File(t uint64, path string) (uint64, int, *_Ctype_char) {
	obj, ok := GetObject(Handle(t))
	if !ok {
		return IH, ErrorCodeNotFound, _Cfunc_CString(MessageNotFound)
	}
	tree := obj.(*git.Tree)
	file, err := tree.File(CopyString(path))
	if err != nil {
		return IH, ErrorCodeInternal, _Cfunc_CString(err.Error())
	}
	return uint64(RegisterObject(file)), ErrorCodeSuccess, nil
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:58

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:57
func c_Tree_Type(t uint64) int8 {
	obj, ok := GetObject(Handle(t))
	if !ok {
		return -1
	}
	tree := obj.(*git.Tree)
	return int8(tree.Type())
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:68

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:67
func c_Tree_Files(t uint64) uint64 {
	obj, ok := GetObject(Handle(t))
	if !ok {
		return IH
	}
	tree := obj.(*git.Tree)
	iter := tree.Files()
	return uint64(RegisterObject(iter))
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:79

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:78
func c_Tree_Decode(o uint64) (uint64, int, *_Ctype_char) {
	obj, ok := GetObject(Handle(o))
	if !ok {
		return IH, ErrorCodeNotFound, _Cfunc_CString(MessageNotFound)
	}
	cobj := obj.(*plumbing.Object)
	tree := git.Tree{}
	err := tree.Decode(*cobj)
	if err != nil {
		return IH, ErrorCodeInternal, _Cfunc_CString(err.Error())
	}
	return uint64(RegisterObject(&tree)), ErrorCodeSuccess, nil
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:94

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:93
func c_NewTreeWalker(r uint64, t uint64) uint64 {
	obj, ok := GetObject(Handle(r))
	if !ok {
		return IH
	}
	repo := obj.(*git.Repository)
	obj, ok = GetObject(Handle(t))
	if !ok {
		return IH
	}
	tree := obj.(*git.Tree)
	walker := git.NewTreeIter(repo, tree)
	return uint64(RegisterObject(walker))
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:110

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:109
func c_TreeWalker_Next(tw uint64) (*_Ctype_char, *_Ctype_char, uint32, *_Ctype_char, int, *_Ctype_char) {
	obj, ok := GetObject(Handle(tw))
	if !ok {
		return nil, nil, 0, nil, ErrorCodeNotFound, _Cfunc_CString(MessageNotFound)
	}
	walker := obj.(*git.TreeIter)
	name, entry, err := walker.Next()
	if err != nil {
		return nil, nil, 0, nil, ErrorCodeInternal, _Cfunc_CString(err.Error())
	}
	return _Cfunc_CString(name), _Cfunc_CString(entry.Name), uint32(entry.Mode),
		CBytes(entry.Hash[:]), ErrorCodeSuccess, nil
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:125

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:124
func c_TreeWalker_Tree(tw uint64) uint64 {
	obj, ok := GetObject(Handle(tw))
	if !ok {
		return IH
	}
	walker := obj.(*git.TreeIter)
	return uint64(RegisterObject(walker.Tree()))
}

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:135

//line /home/mcuadros/workspace/go/src/gopkg.in/src-d/go-git.v4/cshared/tree_cshared.go:134
func c_TreeWalker_Close(tw uint64) {
	obj, ok := GetObject(Handle(tw))
	if !ok {
		return
	}
	walker := obj.(*git.TreeIter)
	walker.Close()
}
*/