diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2016-02-16 14:06:48 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2016-02-16 14:06:48 +0100 |
commit | eadd0f05f6faf14f94876839f00981da5d642667 (patch) | |
tree | 7a7a4e431b5c95a1e62a013456c1ef07d76f4d32 /include/git2/commit.h | |
parent | 1aa14921827244da8d0a736fff02b3ea293adf6e (diff) | |
download | libgit2-eadd0f05f6faf14f94876839f00981da5d642667.tar.gz |
commit: expose the different kinds of errors
We should be checking whether the object we're looking up is a commit,
and we should let the caller know whether the not-found return code
comes from a bad object type or just a missing signature.
Diffstat (limited to 'include/git2/commit.h')
-rw-r--r-- | include/git2/commit.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h index a92277417..3488c7440 100644 --- a/include/git2/commit.h +++ b/include/git2/commit.h @@ -266,12 +266,18 @@ GIT_EXTERN(int) git_commit_header_field(git_buf *out, const git_commit *commit, /** * Extract the signature from a commit * + * If the id is not for a commit, the error class will be + * `GITERR_INVALID`. If the commit does not have a signature, the + * error class will be `GITERR_OBJECT`. + * * @param signature the signature block * @param signed_data signed data; this is the commit contents minus the signature block * @param repo the repository in which the commit exists * @param commit_id the commit from which to extract the data * @param field the name of the header field containing the signature * block; pass `NULL` to extract the default 'gpgsig' + * @return 0 on success, GIT_ENOTFOUND if the id is not for a commit + * or the commit does not have a signature. */ GIT_EXTERN(int) git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_repository *repo, git_oid *commit_id, const char *field); |