From 7fcec8342890031a0d22f0d013833badd81091e8 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Tue, 11 Dec 2012 22:31:21 -0600 Subject: fetchhead reading/iterating --- include/git2/errors.h | 1 + include/git2/repository.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'include/git2') diff --git a/include/git2/errors.h b/include/git2/errors.h index 63b6bc8ee..8ca900969 100644 --- a/include/git2/errors.h +++ b/include/git2/errors.h @@ -63,6 +63,7 @@ typedef enum { GITERR_THREAD, GITERR_STASH, GITERR_CHECKOUT, + GITERR_FETCHHEAD, } git_error_t; /** diff --git a/include/git2/repository.h b/include/git2/repository.h index 216f59b51..96b47f440 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -490,6 +490,24 @@ GIT_EXTERN(int) git_repository_message(char *out, size_t len, git_repository *re */ GIT_EXTERN(int) git_repository_message_remove(git_repository *repo); +typedef int (*git_repository_fetchhead_foreach_cb)(const char *ref_name, + const char *remote_url, + const git_oid *oid, + unsigned int is_merge, + void *payload); + +/** + * Call callback 'callback' for each entry in the given FETCH_HEAD file. + * + * @param repo A repository object + * @param callback Callback function + * @param payload Pointer to callback data (optional) + * @return 0 on success, GIT_ENOTFOUND, GIT_EUSER or error + */ +GIT_EXTERN(int) git_repository_fetchhead_foreach(git_repository *repo, + git_repository_fetchhead_foreach_cb callback, + void *payload); + /** * Calculate hash of file using repository filtering rules. * -- cgit v1.2.1