diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-29 13:36:36 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-30 22:45:13 -0500 |
commit | fc1a3f456540dfc4dc143b322b943a4264658d56 (patch) | |
tree | 3404931f494be61997af4fc9fe9034884169d73f /src/commit_list.c | |
parent | 6fdb1b2f55da9593576b096ee2eecce61995fb51 (diff) | |
download | libgit2-fc1a3f456540dfc4dc143b322b943a4264658d56.tar.gz |
object: return GIT_EINVALID on parse errors
Return `GIT_EINVALID` on parse errors so that direct callers of parse
functions can determine when there was a failure to parse the object.
The object parser functions will swallow this error code to prevent it
from propagating down the chain to end-users. (`git_merge` should not
return `GIT_EINVALID` when a commit it tries to look up is not valid,
this would be too vague to be useful.)
The only public function that this affects is
`git_signature_from_buffer`, which is now documented as returning
`GIT_EINVALID` when appropriate.
Diffstat (limited to 'src/commit_list.c')
-rw-r--r-- | src/commit_list.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/commit_list.c b/src/commit_list.c index 692b1495f..4585508bc 100644 --- a/src/commit_list.c +++ b/src/commit_list.c @@ -124,16 +124,15 @@ static int commit_quick_parse( { git_oid *parent_oid; git_commit *commit; - int error; size_t i; commit = git__calloc(1, sizeof(*commit)); GIT_ERROR_CHECK_ALLOC(commit); commit->object.repo = walk->repo; - if ((error = git_commit__parse_ext(commit, obj, GIT_COMMIT_PARSE_QUICK)) < 0) { + if (git_commit__parse_ext(commit, obj, GIT_COMMIT_PARSE_QUICK) < 0) { git__free(commit); - return error; + return -1; } if (!git__is_uint16(git_array_size(commit->parent_ids))) { |