Commit 7cc3c9202722c53bf46e5a8f8d0d7180423a7632

John Wiegley 2013-01-29T07:48:36

Added git_repository_new function

diff --git a/include/git2/repository.h b/include/git2/repository.h
index ed837b3..f55ab79 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -137,6 +137,14 @@ GIT_EXTERN(int) git_repository_open_ext(
 GIT_EXTERN(int) git_repository_open_bare(git_repository **out, const char *bare_path);
 
 /**
+ * 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/src/repository.c b/src/repository.c
index 64ab2f4..72b5a07 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -129,6 +129,12 @@ static git_repository *repository_alloc(void)
 	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;