summaryrefslogtreecommitdiff
path: root/include/git2/index.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-06-01 18:34:21 +0200
committerVicent Marti <tanoku@gmail.com>2011-06-01 18:54:47 +0200
commitf7e59c4dcf46e0815ab0e7d435fd16755fdf616c (patch)
tree353d781e1efab8b73eb81a848da8bb276a001dd3 /include/git2/index.h
parentef5ffed39a91e8e645ed77f52ec862d47b081e9c (diff)
downloadlibgit2-f7e59c4dcf46e0815ab0e7d435fd16755fdf616c.tar.gz
index: Change the memory management for repo indexes
The `git_repository_index` call now returns a brand new index that must be manually free'd.
Diffstat (limited to 'include/git2/index.h')
-rw-r--r--include/git2/index.h25
1 files changed, 10 insertions, 15 deletions
diff --git a/include/git2/index.h b/include/git2/index.h
index 57401a94c..45900d08d 100644
--- a/include/git2/index.h
+++ b/include/git2/index.h
@@ -109,29 +109,24 @@ typedef struct git_index_entry_unmerged {
} git_index_entry_unmerged;
/**
- * Create a new Git index object as a memory representation
+ * Create a new bare Git index object as a memory representation
* of the Git index file in 'index_path', without a repository
* to back it.
*
- * Since there is no ODB behind this index, any Index methods
- * which rely on the ODB (e.g. index_add) will fail with the
- * GIT_EBAREINDEX error code.
+ * Since there is no ODB or working directory behind this index,
+ * any Index methods which rely on these (e.g. index_add) will
+ * fail with the GIT_EBAREINDEX error code.
*
- * @param index the pointer for the new index
- * @param index_path the path to the index file in disk
- * @return 0 on success; error code otherwise
- */
-GIT_EXTERN(int) git_index_open_bare(git_index **index, const char *index_path);
-
-/**
- * Open the Index inside the git repository pointed
- * by 'repo'.
+ * If you need to access the index of an actual repository,
+ * use the `git_repository_index` wrapper.
+ *
+ * The index must be freed once it's no longer in use.
*
* @param index the pointer for the new index
- * @param repo the git repo which owns the index
+ * @param index_path the path to the index file in disk
* @return 0 on success; error code otherwise
*/
-GIT_EXTERN(int) git_index_open_inrepo(git_index **index, git_repository *repo);
+GIT_EXTERN(int) git_index_open(git_index **index, const char *index_path);
/**
* Clear the contents (all the entries) of an index object.