libgit2

git_treebuilder_insert

Version:

Add or update an entry to the builder

Insert a new entry for filename in the builder with the given attributes.

If an entry named filename already exists, its attributes will be updated with the given ones.

The optional pointer out can be used to retrieve a pointer to the newly created/updated entry. Pass NULL if you do not need it. The pointer may not be valid past the next operation in this builder. Duplicate the entry if you want to keep it.

No attempt is being made to ensure that the provided oid points to an existing git object in the object database, nor that the attributes make sense regarding the type of the pointed at object.

Signature

int git_treebuilder_insert(const git_tree_entry **out, git_treebuilder *bld, const char *filename, const git_oid *id, git_filemode_t filemode);

Parameters

In
out

Pointer to store the entry (optional)

In
bld

Tree builder

const char *
In
filename

Filename of the entry

In
id

SHA1 oid of the entry

In
filemode

Folder attributes of the entry. This parameter must be valued with one of the following entries: 0040000, 0100644, 0100755, 0120000 or 0160000.

Returns

int

0 or an error code

Versions