From 5fb982066452b08da2434d5148c1539847dff838 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 28 Jan 2013 15:56:04 -0600 Subject: [PATCH] Added git_treebuilder_entrycount Conflicts: src/tree.c --- include/git2/tree.h | 8 ++++++++ src/tree.c | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/include/git2/tree.h b/include/git2/tree.h index 3861102d9..73bfc86f4 100644 --- a/include/git2/tree.h +++ b/include/git2/tree.h @@ -258,6 +258,14 @@ GIT_EXTERN(int) git_treebuilder_create( */ GIT_EXTERN(void) git_treebuilder_clear(git_treebuilder *bld); +/** + * Get the number of entries listed in a treebuilder + * + * @param tree a previously loaded treebuilder. + * @return the number of entries in the treebuilder + */ +GIT_EXTERN(unsigned int) git_treebuilder_entrycount(git_treebuilder *bld); + /** * Free a tree builder * diff --git a/src/tree.c b/src/tree.c index c34e9b940..f64ff3250 100644 --- a/src/tree.c +++ b/src/tree.c @@ -340,6 +340,12 @@ size_t git_tree_entrycount(const git_tree *tree) return tree->entries.length; } +unsigned int git_treebuilder_entrycount(git_treebuilder *bld) +{ + assert(bld); + return bld->entries.length; +} + static int tree_error(const char *str, const char *path) { if (path)