libgit2

git_reference_lookup

Version:

Lookup a reference by name in a repository.

The returned reference must be freed by the user.

The name will be checked for validity. See git_reference_create_symbolic() for rules about valid names.

Signature

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

Parameters

In
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, refs/heads/master, refs/tags/v0.1.0, ...)

Returns

int

0 on success, ENOTFOUND, EINVALIDSPEC or an error code.

Versions