diff --git a/Bindings/Libgit2/Tree.hsc b/Bindings/Libgit2/Tree.hsc
--- a/Bindings/Libgit2/Tree.hsc
+++ b/Bindings/Libgit2/Tree.hsc
@@ -13,6 +13,7 @@
 #cinline git_tree_free , Ptr <git_tree> -> IO ()
 #ccall git_tree_id , Ptr <git_tree> -> IO (Ptr <git_oid>)
 #ccall git_tree_entrycount , Ptr <git_tree> -> IO (CUInt)
+#ccall git_treebuilder_entrycount , Ptr <git_treebuilder> -> IO (CUInt)
 #ccall git_tree_entry_byname , Ptr <git_tree> -> CString -> IO (Ptr <git_tree_entry>)
 #ccall git_tree_entry_byindex , Ptr <git_tree> -> CUInt -> IO (Ptr <git_tree_entry>)
 #ccall git_tree_entry_attributes , Ptr <git_tree_entry> -> IO (CUInt)
diff --git a/hlibgit2.cabal b/hlibgit2.cabal
--- a/hlibgit2.cabal
+++ b/hlibgit2.cabal
@@ -1,5 +1,5 @@
 Name:                hlibgit2
-Version:             0.17.0.4
+Version:             0.17.0.5
 Synopsis:            Low-level bindings to libgit2
 Description:         Bindings to libgit2 v0.17.0.
 License-file:        LICENSE
diff --git a/libgit2/include/git2/repository.h b/libgit2/include/git2/repository.h
--- a/libgit2/include/git2/repository.h
+++ b/libgit2/include/git2/repository.h
@@ -85,6 +85,14 @@
 	const char *ceiling_dirs);
 
 /**
+ * Create a new repository with neither backends nor config object
+ *
+ * Note that this is only useful if you wish to associate the repository
+ * with a non-filesystem-backed object database and config store.
+ */
+GIT_EXTERN(int) git_repository_new(git_repository **out);
+
+/**
  * Free a previously allocated repository
  *
  * Note that after a repository is free'd, all the objects it has spawned
diff --git a/libgit2/include/git2/tree.h b/libgit2/include/git2/tree.h
--- a/libgit2/include/git2/tree.h
+++ b/libgit2/include/git2/tree.h
@@ -190,6 +190,14 @@
 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
  *
  * This will clear all the entries and free to builder.
diff --git a/libgit2/src/repository.c b/libgit2/src/repository.c
--- a/libgit2/src/repository.c
+++ b/libgit2/src/repository.c
@@ -116,6 +116,12 @@
 	return repo;
 }
 
+int git_repository_new(git_repository **out)
+{
+	*out = repository_alloc();
+	return 0;
+}
+
 static int load_config_data(git_repository *repo)
 {
 	int is_bare;
diff --git a/libgit2/src/tree.c b/libgit2/src/tree.c
--- a/libgit2/src/tree.c
+++ b/libgit2/src/tree.c
@@ -231,6 +231,19 @@
 	return tree->entries.length;
 }
 
+unsigned int git_treebuilder_entrycount(git_treebuilder *bld)
+{
+        int count = 0;
+        int i;
+	assert(bld);
+	for (i = 0; i < bld->entries.length; ++i) {
+		git_tree_entry *entry = bld->entries.contents[i];
+		if (! entry->removed)
+                  ++count;
+	}
+	return count;
+}
+
 static int tree_error(const char *str)
 {
 	giterr_set(GITERR_TREE, "%s", str);
