libgit2

git_tree_create_fromindex

Version:

Write a tree to the ODB from the index file

This method will scan the index and write a representation of its current state back to disk; it recursively creates tree objects for each of the subtrees stored in the index, but only returns the OID of the root tree. This is the OID that can be used e.g. to create a commit.

The index instance cannot be bare, and needs to be associated to an existing repository.

Signature

int git_tree_create_fromindex(git_oid *oid, git_index *index);

Parameters

In
oid

Pointer where to store the written tree

In
index

Index to write

Returns

int

0 on success; error code otherwise

Versions