diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-07-11 16:14:12 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-07-12 01:06:11 +0200 |
commit | b1aca6eae084ebe59c5a092314e94019c59ecec6 (patch) | |
tree | 3e8f251d9a98e23c30003a39e23741807b9bae04 /include/git2/commit.h | |
parent | 2b92a154b66f213b664e44544048a2df7708b9de (diff) | |
download | libgit2-b1aca6eae084ebe59c5a092314e94019c59ecec6.tar.gz |
commit: introduce git_commit_nth_gen_ancestor()
Diffstat (limited to 'include/git2/commit.h')
-rw-r--r-- | include/git2/commit.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h index 640adf5c2..5b6da520d 100644 --- a/include/git2/commit.h +++ b/include/git2/commit.h @@ -179,6 +179,25 @@ GIT_EXTERN(int) git_commit_parent(git_commit **parent, git_commit *commit, unsig GIT_EXTERN(const git_oid *) git_commit_parent_oid(git_commit *commit, unsigned int n); /** + * 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. + * + * @param ancestor Pointer where to store the ancestor commit + * @param commit a previously loaded commit. + * @param n the requested generation + * @return 0 on success; GIT_ENOTFOUND if no matching ancestor exists + * or an error code + */ +int git_commit_nth_gen_ancestor( + git_commit **ancestor, + const git_commit *commit, + unsigned int n); + +/** * Create a new commit in the repository using `git_object` * instances as parameters. * |