libgit2

git_reference_lookup

Version:

Lookup a reference by its name in a repository.

The generated reference must be freed by the user.

Signature

int git_reference_lookup(git_reference **reference_out, git_repository *repo, const char *name);

Parameters

In
reference_out

pointer to the looked-up reference

In
repo

the repository to look up the reference

const char *
In
name

the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...)

Returns

int

GIT_SUCCESS or an error code

Versions