libgit2

git_index_open

Version:

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 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.

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.

Signature

int git_index_open(git_index **index, const char *index_path);

Parameters

In
index

the pointer for the new index

const char *
In
index_path

the path to the index file in disk

Returns

int

GIT_SUCCESS or an error code

Versions