diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-01-29 02:12:59 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-01-29 02:12:59 +0200 |
commit | b29e8f19300bb95b9f8307f1438193271233adc8 (patch) | |
tree | 0507587cdeb25cf3d93552ff33e3d599f659b3a6 /src/git2 | |
parent | 37c2d54c8590d3eaeb33aec198089dc917fd351d (diff) | |
download | libgit2-b29e8f19300bb95b9f8307f1438193271233adc8.tar.gz |
Return the created entry in git_tree_add_entry()
Yes, we are breaking the API. Alpha software, deal with it.
We need a way of getting a pointer to each newly added entry to the
index, because manually looking up the entry after creation is
outrageously expensive.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/git2')
-rw-r--r-- | src/git2/tree.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/git2/tree.h b/src/git2/tree.h index 3e003de64..9ebb26562 100644 --- a/src/git2/tree.h +++ b/src/git2/tree.h @@ -132,18 +132,21 @@ GIT_EXTERN(const git_oid *) git_tree_entry_id(git_tree_entry *entry); GIT_EXTERN(int) git_tree_entry_2object(git_object **object, git_tree_entry *entry); /** - * Add a new entry to a tree. + * Add a new entry to a tree and return the new entry. * * This will mark the tree as modified; the new entry will * be written back to disk on the next git_object_write() * + * @param entry_out Pointer to the entry that just got + * created. May be NULL if you are not interested on + * getting the new entry * @param tree Tree object to store the entry * @iparam id OID for the tree entry * @param filename Filename for the tree entry * @param attributes UNIX file attributes for the entry * @return 0 on success; otherwise error code */ -GIT_EXTERN(int) git_tree_add_entry(git_tree *tree, const git_oid *id, const char *filename, int attributes); +GIT_EXTERN(int) git_tree_add_entry(git_tree_entry **entry_out, git_tree *tree, const git_oid *id, const char *filename, int attributes); /** * Remove an entry by its index. |