mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 15:58:29 +00:00
index: Add git_index_new
This commit is contained in:
parent
43eeca04a7
commit
1e808f9cda
@ -125,6 +125,19 @@ enum {
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_open(git_index **index, const char *index_path);
|
||||
|
||||
/**
|
||||
* Create an in-memory index object.
|
||||
*
|
||||
* This index object cannot be read/written to the filesystem,
|
||||
* but may be used to perform in-memory index operations.
|
||||
*
|
||||
* The index must be freed once it's no longer in use.
|
||||
*
|
||||
* @param index the pointer for the new index
|
||||
* @return 0 or an error code
|
||||
*/
|
||||
GIT_EXTERN(int) git_index_new(git_index **index);
|
||||
|
||||
/**
|
||||
* Free an existing index object.
|
||||
*
|
||||
|
@ -287,6 +287,11 @@ int git_index_open(git_index **index_out, const char *index_path)
|
||||
return (index_path != NULL) ? git_index_read(index) : 0;
|
||||
}
|
||||
|
||||
int git_index_new(git_index **out)
|
||||
{
|
||||
return git_index_open(out, NULL);
|
||||
}
|
||||
|
||||
static void index_free(git_index *index)
|
||||
{
|
||||
git_index_entry *e;
|
||||
|
Loading…
Reference in New Issue
Block a user