libgit2

git_index_append

Version:

Add (append) an index entry from a file in disk

A new entry will always be inserted into the index; if the index already contains an entry for such path, the old entry will not be replaced.

The file path must be relative to the repository's working folder and must be readable.

This method will fail in bare index instances.

Signature

int git_index_append(git_index *index, const char *path, int stage);

Parameters

In
index

an existing index object

const char *
In
path

filename to add

int
In
stage

stage for the entry

Returns

int

0 on success, otherwise an error code

Versions