libgit2

git_commit_nth_gen_ancestor

Version:

Get the commit object that is the <n>th generation ancestor of the named commit object, following only the first parents. The returned commit has to be freed by the caller.

Passing 0 as the generation number returns another instance of the base commit itself.

Signature

int git_commit_nth_gen_ancestor(git_commit **ancestor, const git_commit *commit, unsigned int n);

Parameters

In
ancestor

Pointer where to store the ancestor commit

In
commit

a previously loaded commit.

unsigned int
In
n

the requested generation

Returns

int

0 on success; GIT_ENOTFOUND if no matching ancestor exists or an error code

Versions