libgit2

git_object_new

Version:

Create a new in-memory repository object with the given type.

The object's attributes can be filled in using the corresponding setter methods.

The object will be written back to given git_repository when the git_object_write() function is called; objects cannot be written to disk until all their main attributes have been properly filled.

Objects are instantiated with no SHA1 id; their id will be automatically generated when writing to the repository.

Signature

int git_object_new(git_object **object, git_repository *repo, git_otype type);

Parameters

In
object

pointer to the new object

In
repo

Repository where the object belongs

In
type

Type of the object to be created

Returns

int

the new object

Versions