diff options
author | Vicent Martà <vicent@github.com> | 2012-07-12 09:35:35 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2012-07-12 09:35:35 -0700 |
commit | db2d4061f60f9390b9d37100b15ba5e819927aa4 (patch) | |
tree | be93e45ba71395254565a1117a142510d2df30f8 /include/git2 | |
parent | 48bcf81dd2584d91e5922dd1458dab6c4173bdcf (diff) | |
parent | 12595ab8f91a71e5a596a883b31789d5317e9ec2 (diff) | |
download | libgit2-db2d4061f60f9390b9d37100b15ba5e819927aa4.tar.gz |
Merge pull request #814 from nulltoken/topic/revparse-refac
Revparse refactoring: a start
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/commit.h | 19 | ||||
-rw-r--r-- | include/git2/refs.h | 21 |
2 files changed, 40 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. * diff --git a/include/git2/refs.h b/include/git2/refs.h index 7f6eb0e9b..b119e90b1 100644 --- a/include/git2/refs.h +++ b/include/git2/refs.h @@ -363,6 +363,27 @@ GIT_EXTERN(int) git_reference_foreach_glob( */ GIT_EXTERN(int) git_reference_has_log(git_reference *ref); + +/** + * Return the reference supporting the remote tracking branch, + * given a reference branch. + * + * The input reference has to be located in the `refs/heads` + * namespace. + * + * @param tracking_ref Pointer where to store the retrieved + * reference. + * + * @param branch_ref A git local branch reference. + * + * @return 0 on success; GIT_ENOTFOUND when no remote tracking + * reference exists, otherwise an error code. + */ +GIT_EXTERN(int) git_reference_remote_tracking_from_branch( + git_reference **tracking_ref, + git_reference *branch_ref +); + /** @} */ GIT_END_DECL #endif |