summaryrefslogtreecommitdiff
path: root/src/git/commit.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-11-05 03:20:17 +0200
committerVicent Marti <tanoku@gmail.com>2010-11-05 03:20:17 +0200
commit1795f87952a68155a618523799f70473483c7265 (patch)
tree239c2fef7674cc0407523be0a250b563361efc6b /src/git/commit.h
parent1714826fa08ad8612b720c8fdea636a4fc49c480 (diff)
downloadlibgit2-1795f87952a68155a618523799f70473483c7265.tar.gz
Improve error handling
All initialization functions now return error codes instead of pointers. Error codes are now properly propagated on most functions. Several new and more specific error codes have been added in common.h Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/git/commit.h')
-rw-r--r--src/git/commit.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/git/commit.h b/src/git/commit.h
index 5d3fa0adb..8cb3401b6 100644
--- a/src/git/commit.h
+++ b/src/git/commit.h
@@ -23,12 +23,13 @@ typedef struct git_commit git_commit;
* The generated commit object is owned by the revision
* repo and shall not be freed by the user.
*
+ * @param commit pointer to the looked up commit
* @param repo the repo to use when locating the commit.
* @param id identity of the commit to locate. If the object is
* an annotated tag it will be peeled back to the commit.
- * @return the commit; NULL if the commit could not be created
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(git_commit *) git_commit_lookup(git_repository *repo, const git_oid *id);
+GIT_EXTERN(int) git_commit_lookup(git_commit **commit, git_repository *repo, const git_oid *id);
/**
* Create a new in-memory git_commit.
@@ -37,10 +38,11 @@ GIT_EXTERN(git_commit *) git_commit_lookup(git_repository *repo, const git_oid *
* setter methods before it can be written to its
* repository.
*
+ * @param commit pointer to the new commit
* @param repo The repository where the object will reside
- * @return the object if creation was possible; NULL otherwise
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(git_commit *) git_commit_new(git_repository *repo);
+GIT_EXTERN(int) git_commit_new(git_commit ** commit, git_repository *repo);
/**
* Get the id of a commit.