diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-05-19 20:38:17 +0300 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-05-19 20:38:17 +0300 |
commit | f4e2aca29c06db44cae48556291ecfcfbbb7d72d (patch) | |
tree | 0797367be069eb30faffe23e2a4f89a4b7458802 /include/git2/index.h | |
parent | 7b134cfebe3d37f3679119b447edcad12e6beec1 (diff) | |
download | libgit2-f4e2aca29c06db44cae48556291ecfcfbbb7d72d.tar.gz |
index: Fix issues in the unmerged entries API
Diffstat (limited to 'include/git2/index.h')
-rw-r--r-- | include/git2/index.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/git2/index.h b/include/git2/index.h index 2e5c17bc..57401a94 100644 --- a/include/git2/index.h +++ b/include/git2/index.h @@ -98,14 +98,14 @@ typedef struct git_index_entry { unsigned short flags; unsigned short flags_extended; - char *path; + const char *path; } git_index_entry; /** Representation of an unmerged file entry in the index. */ typedef struct git_index_entry_unmerged { unsigned int mode[3]; git_oid oid[3]; - char *path; + const char *path; } git_index_entry_unmerged; /** @@ -256,6 +256,8 @@ GIT_EXTERN(int) git_index_remove(git_index *index, int position); * This entry can be modified, and the changes will be written * back to disk on the next write() call. * + * The entry should not be freed by the caller. + * * @param index an existing index object * @param n the position of the entry * @return a pointer to the entry; NULL if out of bounds @@ -276,17 +278,19 @@ GIT_EXTERN(unsigned int) git_index_entrycount(git_index *index); * @param index an existing index object * @return integer of count of current unmerged entries */ -GIT_EXTERN(unsigned int) git_index_unmerged_entrycount(git_index *index); +GIT_EXTERN(unsigned int) git_index_entrycount_unmerged(git_index *index); /** * Get an unmerged entry from the index. * - * @param entry the pointer to the new unmerged entry + * The returned entry is read-only and should not be modified + * of freed by the caller. + * * @param index an existing index object * @param path path to search - * @return 0 on success, otherwise an error code + * @return the unmerged entry; NULL if not found */ -GIT_EXTERN(int) git_index_get_unmerged(git_index_entry_unmerged **entry, git_index *index, const char *path); +GIT_EXTERN(const git_index_entry_unmerged *) git_index_get_unmerged(git_index *index, const char *path); /** @} */ |