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_symbolic_create() for rules about valid names.

Signature

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

Parameters

Out
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, GIT_ENOTFOUND, GIT_EINVALIDSPEC or an error code.

Versions