docurium 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.gitignore +3 -0
  2. data/Gemfile +5 -0
  3. data/LICENCE +19 -0
  4. data/README.md +39 -0
  5. data/TODO.txt +19 -0
  6. data/bin/cm +31 -0
  7. data/docurium.gemspec +25 -0
  8. data/lib/docurium.rb +435 -0
  9. data/lib/docurium/cli.rb +10 -0
  10. data/site/css/style.css +236 -0
  11. data/site/images/search_icon.png +0 -0
  12. data/site/index.html +65 -0
  13. data/site/js/backbone.js +27 -0
  14. data/site/js/docurium.js +649 -0
  15. data/site/js/json2.js +26 -0
  16. data/site/js/underscore.js +26 -0
  17. data/site/shared/css/documentation.css +797 -0
  18. data/site/shared/css/pygments.css +60 -0
  19. data/site/shared/images/active-arrow.png +0 -0
  20. data/site/shared/images/background-v2.png +0 -0
  21. data/site/shared/images/background-white.png +0 -0
  22. data/site/shared/images/dropdown_sprites.jpg +0 -0
  23. data/site/shared/images/footer_logo.png +0 -0
  24. data/site/shared/images/logo.png +0 -0
  25. data/site/shared/images/nav-rule.png +0 -0
  26. data/site/shared/images/next_step_arrow.gif +0 -0
  27. data/site/shared/images/qmark.png +0 -0
  28. data/site/shared/js/documentation.js +43 -0
  29. data/site/shared/js/jquery.js +154 -0
  30. data/test/fixtures/git2/api.docurium +6 -0
  31. data/test/fixtures/git2/blob.h +121 -0
  32. data/test/fixtures/git2/commit.h +302 -0
  33. data/test/fixtures/git2/common.h +98 -0
  34. data/test/fixtures/git2/errors.h +149 -0
  35. data/test/fixtures/git2/index.h +270 -0
  36. data/test/fixtures/git2/object.h +147 -0
  37. data/test/fixtures/git2/odb.h +302 -0
  38. data/test/fixtures/git2/odb_backend.h +107 -0
  39. data/test/fixtures/git2/oid.h +191 -0
  40. data/test/fixtures/git2/refs.h +325 -0
  41. data/test/fixtures/git2/repository.h +217 -0
  42. data/test/fixtures/git2/revwalk.h +187 -0
  43. data/test/fixtures/git2/signature.h +81 -0
  44. data/test/fixtures/git2/tag.h +297 -0
  45. data/test/fixtures/git2/thread-utils.h +71 -0
  46. data/test/fixtures/git2/tree.h +266 -0
  47. data/test/fixtures/git2/types.h +162 -0
  48. data/test/fixtures/git2/zlib.h +58 -0
  49. data/test/repo_test.rb +101 -0
  50. data/test/test_helper.rb +29 -0
  51. metadata +167 -0
@@ -0,0 +1,297 @@
1
+ /*
2
+ * This file is free software; you can redistribute it and/or modify
3
+ * it under the terms of the GNU General Public License, version 2,
4
+ * as published by the Free Software Foundation.
5
+ *
6
+ * In addition to the permissions in the GNU General Public License,
7
+ * the authors give you unlimited permission to link the compiled
8
+ * version of this file into combinations with other programs,
9
+ * and to distribute those combinations without any restriction
10
+ * coming from the use of this file. (The General Public License
11
+ * restrictions do apply in other respects; for example, they cover
12
+ * modification of the file, and distribution when not linked into
13
+ * a combined executable.)
14
+ *
15
+ * This file is distributed in the hope that it will be useful, but
16
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; see the file COPYING. If not, write to
22
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23
+ * Boston, MA 02110-1301, USA.
24
+ */
25
+ #ifndef INCLUDE_git_tag_h__
26
+ #define INCLUDE_git_tag_h__
27
+
28
+ #include "common.h"
29
+ #include "types.h"
30
+ #include "oid.h"
31
+ #include "object.h"
32
+
33
+ /**
34
+ * @file git2/tag.h
35
+ * @brief Git tag parsing routines
36
+ * @defgroup git_tag Git tag management
37
+ * @ingroup Git
38
+ * @{
39
+ */
40
+ GIT_BEGIN_DECL
41
+
42
+ /**
43
+ * Lookup a tag object from the repository.
44
+ *
45
+ * @param tag pointer to the looked up tag
46
+ * @param repo the repo to use when locating the tag.
47
+ * @param id identity of the tag to locate.
48
+ * @return 0 on success; error code otherwise
49
+ */
50
+ GIT_INLINE(int) git_tag_lookup(git_tag **tag, git_repository *repo, const git_oid *id)
51
+ {
52
+ return git_object_lookup((git_object **)tag, repo, id, (git_otype)GIT_OBJ_TAG);
53
+ }
54
+
55
+ /**
56
+ * Close an open tag
57
+ *
58
+ * This is a wrapper around git_object_close()
59
+ *
60
+ * IMPORTANT:
61
+ * It *is* necessary to call this method when you stop
62
+ * using a tag. Failure to do so will cause a memory leak.
63
+ *
64
+ * @param tag the tag to close
65
+ */
66
+
67
+ GIT_INLINE(void) git_tag_close(git_tag *tag)
68
+ {
69
+ git_object_close((git_object *) tag);
70
+ }
71
+
72
+
73
+ /**
74
+ * Get the id of a tag.
75
+ *
76
+ * @param tag a previously loaded tag.
77
+ * @return object identity for the tag.
78
+ */
79
+ GIT_EXTERN(const git_oid *) git_tag_id(git_tag *tag);
80
+
81
+ /**
82
+ * Get the tagged object of a tag
83
+ *
84
+ * This method performs a repository lookup for the
85
+ * given object and returns it
86
+ *
87
+ * @param target pointer where to store the target
88
+ * @param tag a previously loaded tag.
89
+ * @return 0 on success; error code otherwise
90
+ */
91
+ GIT_EXTERN(int) git_tag_target(git_object **target, git_tag *t);
92
+
93
+ /**
94
+ * Get the OID of the tagged object of a tag
95
+ *
96
+ * @param tag a previously loaded tag.
97
+ * @return pointer to the OID
98
+ */
99
+ GIT_EXTERN(const git_oid *) git_tag_target_oid(git_tag *t);
100
+
101
+ /**
102
+ * Get the type of a tag's tagged object
103
+ *
104
+ * @param tag a previously loaded tag.
105
+ * @return type of the tagged object
106
+ */
107
+ GIT_EXTERN(git_otype) git_tag_type(git_tag *t);
108
+
109
+ /**
110
+ * Get the name of a tag
111
+ *
112
+ * @param tag a previously loaded tag.
113
+ * @return name of the tag
114
+ */
115
+ GIT_EXTERN(const char *) git_tag_name(git_tag *t);
116
+
117
+ /**
118
+ * Get the tagger (author) of a tag
119
+ *
120
+ * @param tag a previously loaded tag.
121
+ * @return reference to the tag's author
122
+ */
123
+ GIT_EXTERN(const git_signature *) git_tag_tagger(git_tag *t);
124
+
125
+ /**
126
+ * Get the message of a tag
127
+ *
128
+ * @param tag a previously loaded tag.
129
+ * @return message of the tag
130
+ */
131
+ GIT_EXTERN(const char *) git_tag_message(git_tag *t);
132
+
133
+
134
+ /**
135
+ * Create a new tag in the repository from an OID
136
+ *
137
+ * @param oid Pointer where to store the OID of the
138
+ * newly created tag
139
+ *
140
+ * @param repo Repository where to store the tag
141
+ *
142
+ * @param tag_name Name for the tag; this name is validated
143
+ * for consistency. It should also not conflict with an
144
+ * already existing tag name
145
+ *
146
+ * @param target OID to which this tag points; note that no
147
+ * validation is done on this OID. Use the _o version of this
148
+ * method to assure a proper object is being tagged
149
+ *
150
+ * @param target_type Type of the tagged OID; note that no
151
+ * validation is performed here either
152
+ *
153
+ * @param tagger Signature of the tagger for this tag, and
154
+ * of the tagging time
155
+ *
156
+ * @param message Full message for this tag
157
+ *
158
+ * @return 0 on success; error code otherwise.
159
+ * A tag object is written to the ODB, and a proper reference
160
+ * is written in the /refs/tags folder, pointing to it
161
+ */
162
+ GIT_EXTERN(int) git_tag_create(
163
+ git_oid *oid,
164
+ git_repository *repo,
165
+ const char *tag_name,
166
+ const git_oid *target,
167
+ git_otype target_type,
168
+ const git_signature *tagger,
169
+ const char *message);
170
+
171
+
172
+ /**
173
+ * Create a new tag in the repository from an existing
174
+ * `git_object` instance
175
+ *
176
+ * This method replaces the `target` and `target_type`
177
+ * paremeters of `git_tag_create` by a single instance
178
+ * of a `const git_object *`, which is assured to be
179
+ * a proper object in the ODB and hence will create
180
+ * a valid tag
181
+ *
182
+ * @see git_tag_create
183
+ */
184
+ GIT_EXTERN(int) git_tag_create_o(
185
+ git_oid *oid,
186
+ git_repository *repo,
187
+ const char *tag_name,
188
+ const git_object *target,
189
+ const git_signature *tagger,
190
+ const char *message);
191
+
192
+ /**
193
+ * Create a new tag in the repository from a buffer
194
+ *
195
+ * @param oid Pointer where to store the OID of the newly created tag
196
+ *
197
+ * @param repo Repository where to store the tag
198
+ *
199
+ * @param buffer Raw tag data
200
+ */
201
+ GIT_EXTERN(int) git_tag_create_frombuffer(
202
+ git_oid *oid,
203
+ git_repository *repo,
204
+ const char *buffer);
205
+
206
+ /**
207
+ * Create a new tag in the repository from an OID
208
+ * and overwrite an already existing tag reference, if any.
209
+ *
210
+ * @param oid Pointer where to store the OID of the
211
+ * newly created tag
212
+ *
213
+ * @param repo Repository where to store the tag
214
+ *
215
+ * @param tag_name Name for the tag; this name is validated
216
+ * for consistency.
217
+ *
218
+ * @param target OID to which this tag points; note that no
219
+ * validation is done on this OID. Use the _fo version of this
220
+ * method to assure a proper object is being tagged
221
+ *
222
+ * @param target_type Type of the tagged OID; note that no
223
+ * validation is performed here either
224
+ *
225
+ * @param tagger Signature of the tagger for this tag, and
226
+ * of the tagging time
227
+ *
228
+ * @param message Full message for this tag
229
+ *
230
+ * @return 0 on success; error code otherwise.
231
+ * A tag object is written to the ODB, and a proper reference
232
+ * is written in the /refs/tags folder, pointing to it
233
+ */
234
+ GIT_EXTERN(int) git_tag_create_f(
235
+ git_oid *oid,
236
+ git_repository *repo,
237
+ const char *tag_name,
238
+ const git_oid *target,
239
+ git_otype target_type,
240
+ const git_signature *tagger,
241
+ const char *message);
242
+
243
+ /**
244
+ * Create a new tag in the repository from an existing
245
+ * `git_object` instance and overwrite an already existing
246
+ * tag reference, if any.
247
+ *
248
+ * This method replaces the `target` and `target_type`
249
+ * paremeters of `git_tag_create_f` by a single instance
250
+ * of a `const git_object *`, which is assured to be
251
+ * a proper object in the ODB and hence will create
252
+ * a valid tag
253
+ *
254
+ * @see git_tag_create_f
255
+ */
256
+ GIT_EXTERN(int) git_tag_create_fo(
257
+ git_oid *oid,
258
+ git_repository *repo,
259
+ const char *tag_name,
260
+ const git_object *target,
261
+ const git_signature *tagger,
262
+ const char *message);
263
+
264
+ /**
265
+ * Delete an existing tag reference.
266
+ *
267
+ * @param repo Repository where lives the tag
268
+ *
269
+ * @param tag_name Name of the tag to be deleted;
270
+ * this name is validated for consistency.
271
+ *
272
+ * @return 0 on success; error code otherwise.
273
+ */
274
+ GIT_EXTERN(int) git_tag_delete(
275
+ git_repository *repo,
276
+ const char *tag_name);
277
+
278
+ /**
279
+ * Fill a list with all the tags in the Repository
280
+ *
281
+ * The string array will be filled with the names of the
282
+ * matching tags; these values are owned by the user and
283
+ * should be free'd manually when no longer needed, using
284
+ * `git_strarray_free`.
285
+ *
286
+ * @param array Pointer to a git_strarray structure where
287
+ * the tag names will be stored
288
+ * @param repo Repository where to find the tags
289
+ * @return 0 on success; error code otherwise
290
+ */
291
+ GIT_EXTERN(int) git_tag_list(
292
+ git_strarray *tag_names,
293
+ git_repository *repo);
294
+
295
+ /** @} */
296
+ GIT_END_DECL
297
+ #endif
@@ -0,0 +1,71 @@
1
+ /*
2
+ * This file is free software; you can redistribute it and/or modify
3
+ * it under the terms of the GNU General Public License, version 2,
4
+ * as published by the Free Software Foundation.
5
+ *
6
+ * In addition to the permissions in the GNU General Public License,
7
+ * the authors give you unlimited permission to link the compiled
8
+ * version of this file into combinations with other programs,
9
+ * and to distribute those combinations without any restriction
10
+ * coming from the use of this file. (The General Public License
11
+ * restrictions do apply in other respects; for example, they cover
12
+ * modification of the file, and distribution when not linked into
13
+ * a combined executable.)
14
+ *
15
+ * This file is distributed in the hope that it will be useful, but
16
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; see the file COPYING. If not, write to
22
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23
+ * Boston, MA 02110-1301, USA.
24
+ */
25
+ #ifndef INCLUDE_git_thread_utils_h__
26
+ #define INCLUDE_git_thread_utils_h__
27
+
28
+ /*
29
+ * How TLS works is compiler+platform dependant
30
+ * Sources: http://en.wikipedia.org/wiki/Thread-Specific_Storage
31
+ * http://predef.sourceforge.net/precomp.html
32
+ */
33
+
34
+ #define GIT_HAS_TLS 1
35
+
36
+ #if defined(__APPLE__) && defined(__MACH__)
37
+ # undef GIT_TLS
38
+ # define GIT_TLS
39
+
40
+ #elif defined(__GNUC__) || \
41
+ defined(__SUNPRO_C) || \
42
+ defined(__SUNPRO_CC) || \
43
+ defined(__xlc__) || \
44
+ defined(__xlC__)
45
+ # define GIT_TLS __thread
46
+
47
+ #elif defined(__INTEL_COMPILER)
48
+ # if defined(_WIN32) || defined(_WIN32_CE)
49
+ # define GIT_TLS __declspec(thread)
50
+ # else
51
+ # define GIT_TLS __thread
52
+ # endif
53
+
54
+ #elif defined(_WIN32) || \
55
+ defined(_WIN32_CE) || \
56
+ defined(__BORLANDC__)
57
+ # define GIT_TLS __declspec(thread)
58
+
59
+ #else
60
+ # undef GIT_HAS_TLS
61
+ # define GIT_TLS /* nothing: tls vars are thread-global */
62
+ #endif
63
+
64
+ /* sparse and cygwin don't grok thread-local variables */
65
+ #if defined(__CHECKER__) || defined(__CYGWIN__)
66
+ # undef GIT_HAS_TLS
67
+ # undef GIT_TLS
68
+ # define GIT_TLS
69
+ #endif
70
+
71
+ #endif /* INCLUDE_git_thread_utils_h__ */
@@ -0,0 +1,266 @@
1
+ /*
2
+ * This file is free software; you can redistribute it and/or modify
3
+ * it under the terms of the GNU General Public License, version 2,
4
+ * as published by the Free Software Foundation.
5
+ *
6
+ * In addition to the permissions in the GNU General Public License,
7
+ * the authors give you unlimited permission to link the compiled
8
+ * version of this file into combinations with other programs,
9
+ * and to distribute those combinations without any restriction
10
+ * coming from the use of this file. (The General Public License
11
+ * restrictions do apply in other respects; for example, they cover
12
+ * modification of the file, and distribution when not linked into
13
+ * a combined executable.)
14
+ *
15
+ * This file is distributed in the hope that it will be useful, but
16
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ * General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; see the file COPYING. If not, write to
22
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23
+ * Boston, MA 02110-1301, USA.
24
+ */
25
+ #ifndef INCLUDE_git_tree_h__
26
+ #define INCLUDE_git_tree_h__
27
+
28
+ #include "common.h"
29
+ #include "types.h"
30
+ #include "oid.h"
31
+ #include "object.h"
32
+
33
+ /**
34
+ * @file git2/tree.h
35
+ * @brief Git tree parsing, loading routines
36
+ * @defgroup git_tree Git tree parsing, loading routines
37
+ * @ingroup Git
38
+ * @{
39
+ */
40
+ GIT_BEGIN_DECL
41
+
42
+ /**
43
+ * Lookup a tree object from the repository.
44
+ *
45
+ * @param tree pointer to the looked up tree
46
+ * @param repo the repo to use when locating the tree.
47
+ * @param id identity of the tree to locate.
48
+ * @return 0 on success; error code otherwise
49
+ */
50
+ GIT_INLINE(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git_oid *id)
51
+ {
52
+ return git_object_lookup((git_object **)tree, repo, id, GIT_OBJ_TREE);
53
+ }
54
+
55
+ /**
56
+ * Close an open tree
57
+ *
58
+ * This is a wrapper around git_object_close()
59
+ *
60
+ * IMPORTANT:
61
+ * It *is* necessary to call this method when you stop
62
+ * using a tree. Failure to do so will cause a memory leak.
63
+ *
64
+ * @param tree the tree to close
65
+ */
66
+
67
+ GIT_INLINE(void) git_tree_close(git_tree *tree)
68
+ {
69
+ git_object_close((git_object *) tree);
70
+ }
71
+
72
+
73
+ /**
74
+ * Get the id of a tree.
75
+ *
76
+ * @param tree a previously loaded tree.
77
+ * @return object identity for the tree.
78
+ */
79
+ GIT_EXTERN(const git_oid *) git_tree_id(git_tree *tree);
80
+
81
+ /**
82
+ * Get the number of entries listed in a tree
83
+ *
84
+ * @param tree a previously loaded tree.
85
+ * @return the number of entries in the tree
86
+ */
87
+ GIT_EXTERN(size_t) git_tree_entrycount(git_tree *tree);
88
+
89
+ /**
90
+ * Lookup a tree entry by its filename
91
+ *
92
+ * @param tree a previously loaded tree.
93
+ * @param filename the filename of the desired entry
94
+ * @return the tree entry; NULL if not found
95
+ */
96
+ GIT_EXTERN(const git_tree_entry *) git_tree_entry_byname(git_tree *tree, const char *filename);
97
+
98
+ /**
99
+ * Lookup a tree entry by its position in the tree
100
+ *
101
+ * @param tree a previously loaded tree.
102
+ * @param idx the position in the entry list
103
+ * @return the tree entry; NULL if not found
104
+ */
105
+ GIT_EXTERN(const git_tree_entry *) git_tree_entry_byindex(git_tree *tree, int idx);
106
+
107
+ /**
108
+ * Get the UNIX file attributes of a tree entry
109
+ *
110
+ * @param entry a tree entry
111
+ * @return attributes as an integer
112
+ */
113
+ GIT_EXTERN(unsigned int) git_tree_entry_attributes(const git_tree_entry *entry);
114
+
115
+ /**
116
+ * Get the filename of a tree entry
117
+ *
118
+ * @param entry a tree entry
119
+ * @return the name of the file
120
+ */
121
+ GIT_EXTERN(const char *) git_tree_entry_name(const git_tree_entry *entry);
122
+
123
+ /**
124
+ * Get the id of the object pointed by the entry
125
+ *
126
+ * @param entry a tree entry
127
+ * @return the oid of the object
128
+ */
129
+ GIT_EXTERN(const git_oid *) git_tree_entry_id(const git_tree_entry *entry);
130
+
131
+ /**
132
+ * Convert a tree entry to the git_object it points too.
133
+ *
134
+ * @param object pointer to the converted object
135
+ * @param repo repository where to lookup the pointed object
136
+ * @param entry a tree entry
137
+ * @return 0 on success; error code otherwise
138
+ */
139
+ GIT_EXTERN(int) git_tree_entry_2object(git_object **object_out, git_repository *repo, const git_tree_entry *entry);
140
+
141
+ /**
142
+ * Write a tree to the ODB from the index file
143
+ *
144
+ * This method will scan the index and write a representation
145
+ * of its current state back to disk; it recursively creates
146
+ * tree objects for each of the subtrees stored in the index,
147
+ * but only returns the OID of the root tree. This is the OID
148
+ * that can be used e.g. to create a commit.
149
+ *
150
+ * The index instance cannot be bare, and needs to be associated
151
+ * to an existing repository.
152
+ *
153
+ * @param oid Pointer where to store the written tree
154
+ * @param index Index to write
155
+ * @return 0 on success; error code otherwise
156
+ */
157
+ GIT_EXTERN(int) git_tree_create_fromindex(git_oid *oid, git_index *index);
158
+
159
+ /**
160
+ * Create a new tree builder.
161
+ *
162
+ * The tree builder can be used to create or modify
163
+ * trees in memory and write them as tree objects to the
164
+ * database.
165
+ *
166
+ * If the `source` parameter is not NULL, the tree builder
167
+ * will be initialized with the entries of the given tree.
168
+ *
169
+ * If the `source` parameter is NULL, the tree builder will
170
+ * have no entries and will have to be filled manually.
171
+ *
172
+ * @param builder_p Pointer where to store the tree builder
173
+ * @param source Source tree to initialize the builder (optional)
174
+ * @return 0 on sucess; error code otherwise
175
+ */
176
+ GIT_EXTERN(int) git_treebuilder_create(git_treebuilder **builder_p, const git_tree *source);
177
+
178
+ /**
179
+ * Clear all the entires in the builder
180
+ *
181
+ * @param bld Builder to clear
182
+ */
183
+ GIT_EXTERN(void) git_treebuilder_clear(git_treebuilder *bld);
184
+
185
+ /**
186
+ * Free a tree builder
187
+ *
188
+ * This will clear all the entries and free to builder.
189
+ * Failing to free the builder after you're done using it
190
+ * will result in a memory leak
191
+ *
192
+ * @param bld Builder to free
193
+ */
194
+ GIT_EXTERN(void) git_treebuilder_free(git_treebuilder *bld);
195
+
196
+ /**
197
+ * Get an entry from the builder from its filename
198
+ *
199
+ * The returned entry is owned by the builder and should
200
+ * not be freed manually.
201
+ *
202
+ * @param bld Tree builder
203
+ * @param filename Name of the entry
204
+ * @return pointer to the entry; NULL if not found
205
+ */
206
+ GIT_EXTERN(const git_tree_entry *) git_treebuilder_get(git_treebuilder *bld, const char *filename);
207
+
208
+ /**
209
+ * Add or update an entry to the builder
210
+ *
211
+ * Insert a new entry for `filename` in the builder with the
212
+ * given attributes.
213
+ *
214
+ * if an entry named `filename` already exists, its attributes
215
+ * will be updated with the given ones.
216
+ *
217
+ * The optional pointer `entry_out` can be used to retrieve a
218
+ * pointer to the newly created/updated entry.
219
+ *
220
+ * @param entry_out Pointer to store the entry (optional)
221
+ * @param bld Tree builder
222
+ * @param filename Filename of the entry
223
+ * @param id SHA1 oid of the entry
224
+ * @param attributes Folder attributes of the entry
225
+ * @return 0 on success; error code otherwise
226
+ */
227
+ GIT_EXTERN(int) git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, const char *filename, const git_oid *id, unsigned int attributes);
228
+
229
+ /**
230
+ * Remove an entry from the builder by its filename
231
+ *
232
+ * @param bld Tree builder
233
+ * @param filename Filename of the entry to remove
234
+ */
235
+ GIT_EXTERN(int) git_treebuilder_remove(git_treebuilder *bld, const char *filename);
236
+
237
+ /**
238
+ * Filter the entries in the tree
239
+ *
240
+ * The `filter` callback will be called for each entry
241
+ * in the tree with a pointer to the entry and the
242
+ * provided `payload`: if the callback returns 1, the
243
+ * entry will be filtered (removed from the builder).
244
+ *
245
+ * @param bld Tree builder
246
+ * @param filter Callback to filter entries
247
+ */
248
+ GIT_EXTERN(void) git_treebuilder_filter(git_treebuilder *bld, int (*filter)(const git_tree_entry *, void *), void *payload);
249
+
250
+ /**
251
+ * Write the contents of the tree builder as a tree object
252
+ *
253
+ * The tree builder will be written to the given `repo`, and
254
+ * it's identifying SHA1 hash will be stored in the `oid`
255
+ * pointer.
256
+ *
257
+ * @param oid Pointer where to store the written OID
258
+ * @param repo Repository where to store the object
259
+ * @param bld Tree builder to write
260
+ * @return 0 on success; error code otherwise
261
+ */
262
+ GIT_EXTERN(int) git_treebuilder_write(git_oid *oid, git_repository *repo, git_treebuilder *bld);
263
+
264
+ /** @} */
265
+ GIT_END_DECL
266
+ #endif