diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-06-01 18:34:21 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-06-01 18:54:47 +0200 |
commit | f7e59c4dcf46e0815ab0e7d435fd16755fdf616c (patch) | |
tree | 353d781e1efab8b73eb81a848da8bb276a001dd3 /include/git2/index.h | |
parent | ef5ffed39a91e8e645ed77f52ec862d47b081e9c (diff) | |
download | libgit2-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.h | 25 |
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. |