libgit2

git_tag_create

Version:

Create a new tag in the repository from an OID

Signature

int git_tag_create(git_oid *oid, git_repository *repo, const char *tag_name, const git_oid *target, git_otype target_type, const git_signature *tagger, const char *message);

Parameters

In
oid

Pointer where to store the OID of the newly created tag. If the tag already exists, this parameter will be the oid of the existed tag, and the function will return a GIT_EEXISTS error code.

In
repo

Repository where to store the tag

const char *
In
tag_name

Name for the tag; this name is validated for consistency. It should also not conflict with an already existing tag name

In
target

OID to which this tag points; note that no validation is done on this OID. Use the _o version of this method to assure a proper object is being tagged

In
target_type

Type of the tagged OID; note that no validation is performed here either

In
tagger

Signature of the tagger for this tag, and of the tagging time

const char *
In
message

Full message for this tag

Returns

int

0 on success; error code otherwise. A tag object is written to the ODB, and a proper reference is written in the /refs/tags folder, pointing to it

Versions