From b1aca6eae084ebe59c5a092314e94019c59ecec6 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Wed, 11 Jul 2012 16:14:12 +0200 Subject: commit: introduce git_commit_nth_gen_ancestor() --- include/git2/commit.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/git2/commit.h') diff --git a/include/git2/commit.h b/include/git2/commit.h index 640adf5c..5b6da520 100644 --- a/include/git2/commit.h +++ b/include/git2/commit.h @@ -178,6 +178,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 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. -- cgit v1.2.1 From 1ebe432e2f685c72774aa5012f99fbb4845cffba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 12 Jul 2012 20:33:30 +0200 Subject: commit: properly export git_commit_nth_gen_ancestor() --- include/git2/commit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/git2/commit.h') diff --git a/include/git2/commit.h b/include/git2/commit.h index 5b6da520..e8ecc808 100644 --- a/include/git2/commit.h +++ b/include/git2/commit.h @@ -192,7 +192,7 @@ GIT_EXTERN(const git_oid *) git_commit_parent_oid(git_commit *commit, unsigned i * @return 0 on success; GIT_ENOTFOUND if no matching ancestor exists * or an error code */ -int git_commit_nth_gen_ancestor( +GIT_EXTERN(int) git_commit_nth_gen_ancestor( git_commit **ancestor, const git_commit *commit, unsigned int n); -- cgit v1.2.1