libgit2

git_repository_lookup_ref

Version:

Lookup a reference by its name in the repository.

The generated reference is owned by the repository and should not be freed by the user.

TODO: - Ensure the reference name is valid

Signature

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

Parameters

git_reference **
In
reference_out

pointer to the looked-up reference

git_repository *
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

a reference to the reference

Versions