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_bypath) will fail with the GIT_ERROR 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_out, const char *index_path);

Parameters

In
index_out

the pointer for the new index

const char *
In
index_path

the path to the index file in disk

Returns

int

0 or an error code

Versions