diff options
| author | Russell Belfer <rb@github.com> | 2012-09-10 23:15:54 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-09-10 23:15:54 -0700 |
| commit | eff14d384c3b0696e3ef0979bfc58d5558a2ab23 (patch) | |
| tree | 6f624ed19336c36c97598dbff2ab3d360dadcdcf /include/git2 | |
| parent | 17b06f4d47bfd9fae8073c85d71751df94e50050 (diff) | |
| parent | cf4c43abaa2d8dace6d70e21c23f7d779a9ad473 (diff) | |
| download | libgit2-eff14d384c3b0696e3ef0979bfc58d5558a2ab23.tar.gz | |
Merge pull request #906 from nulltoken/topic/git_reference_peel
git reference peel
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/checkout.h | 22 | ||||
| -rw-r--r-- | include/git2/errors.h | 1 | ||||
| -rw-r--r-- | include/git2/refs.h | 20 |
3 files changed, 33 insertions, 10 deletions
diff --git a/include/git2/checkout.h b/include/git2/checkout.h index ac31b3462..deb828722 100644 --- a/include/git2/checkout.h +++ b/include/git2/checkout.h @@ -40,13 +40,13 @@ typedef struct git_checkout_opts { * @param repo repository to check out (must be non-bare) * @param opts specifies checkout options (may be NULL) * @param stats structure through which progress information is reported - * @return 0 on success, GIT_ERROR otherwise (use giterr_last for information about the error) + * @return 0 on success, GIT_ERROR otherwise (use giterr_last for information + * about the error) */ -GIT_EXTERN(int) git_checkout_head(git_repository *repo, - git_checkout_opts *opts, - git_indexer_stats *stats); - - +GIT_EXTERN(int) git_checkout_head( + git_repository *repo, + git_checkout_opts *opts, + git_indexer_stats *stats); /** * Updates files in the working tree to match a commit pointed to by a ref. @@ -54,11 +54,13 @@ GIT_EXTERN(int) git_checkout_head(git_repository *repo, * @param ref reference to follow to a commit * @param opts specifies checkout options (may be NULL) * @param stats structure through which progress information is reported - * @return 0 on success, GIT_ERROR otherwise (use giterr_last for information about the error) + * @return 0 on success, GIT_ERROR otherwise (use giterr_last for information + * about the error) */ -GIT_EXTERN(int) git_checkout_reference(git_reference *ref, - git_checkout_opts *opts, - git_indexer_stats *stats); +GIT_EXTERN(int) git_checkout_reference( + git_reference *ref, + git_checkout_opts *opts, + git_indexer_stats *stats); /** @} */ diff --git a/include/git2/errors.h b/include/git2/errors.h index f6671c49d..e5f435926 100644 --- a/include/git2/errors.h +++ b/include/git2/errors.h @@ -26,6 +26,7 @@ enum { GIT_EAMBIGUOUS = -5, GIT_EBUFS = -6, GIT_EUSER = -7, + GIT_EBAREREPO = -8, GIT_PASSTHROUGH = -30, GIT_ITEROVER = -31, diff --git a/include/git2/refs.h b/include/git2/refs.h index 660b48b5f..73b32a9e2 100644 --- a/include/git2/refs.h +++ b/include/git2/refs.h @@ -434,6 +434,26 @@ GIT_EXTERN(int) git_reference_normalize_name( const char *name, unsigned int flags); +/** + * Recursively peel an reference until an object of the + * specified type is met. + * + * The retrieved `peeled` object is owned by the repository + * and should be closed with the `git_object_free` method. + * + * If you pass `GIT_OBJ_ANY` as the target type, then the object + * will be peeled until a non-tag object is met. + * + * @param peeled Pointer to the peeled git_object + * @param ref The reference to be processed + * @param target_type The type of the requested object + * @return 0 or an error code + */ +GIT_EXTERN(int) git_reference_peel( + git_object **out, + git_reference *ref, + git_otype type); + /** @} */ GIT_END_DECL #endif |
