git_index_add_from_buffer

Add or update an index entry from a buffer in memory

This method will create a blob in the repository that owns the index and then add the index entry to the index. The path of the entry represents the position of the blob relative to the repository's root folder.

If a previous index entry exists that has the same path as the given 'entry', it will be replaced. Otherwise, the 'entry' will be added. The id and the file_size of the 'entry' are updated with the real value of the blob.

This forces the file to be added to the index, not looking at gitignore rules. Those rules can be evaluated through the git_status APIs (in status.h) before calling this.

If this file currently is the result of a merge conflict, this file will no longer be marked as conflicting. The data about the conflict will be moved to the "resolve undo" (REUC) section.

extern (C) nothrow @nogc
int
git_index_add_from_buffer

Parameters

index libgit2_d.types.git_index*

an existing index object

entry const(.git_index_entry)*

filename to add

buffer const(void)*

data to be written into the blob

len size_t

length of the data

Return Value

Type: int

0 or an error code

Meta