summaryrefslogtreecommitdiff
path: root/src/revparse.c
diff options
context:
space:
mode:
authorBen Straub <bstraub@github.com>2012-05-11 11:58:02 -0700
committerBen Straub <bstraub@github.com>2012-05-11 11:58:02 -0700
commit72b86bae50f3dc0ec1a9df0b62c70ab9bdb37c77 (patch)
tree29295940ad3e32664ee8ce8c8aea749e66d7ad99 /src/revparse.c
parent92ad5a5cda94c04b24d84c20ede235d69bedb988 (diff)
downloadlibgit2-72b86bae50f3dc0ec1a9df0b62c70ab9bdb37c77.tar.gz
Rev-parse: better error handling for chaining.
Fixed an error where "nonexistant^N" or similar would fall into an assert. This now properly returns an error.
Diffstat (limited to 'src/revparse.c')
-rw-r--r--src/revparse.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/revparse.c b/src/revparse.c
index 7cb96b806..3487f5638 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -564,7 +564,10 @@ int git_revparse_single(git_object **out, git_repository *repo, const char *spec
if (current_state != next_state && next_state != REVPARSE_STATE_DONE) {
/* Leaving INIT state, find the object specified, in case that state needs it */
- revparse_lookup_object(&next_obj, repo, git_buf_cstr(&specbuffer));
+ if (revparse_lookup_object(&next_obj, repo, git_buf_cstr(&specbuffer)) < 0) {
+ retcode = GIT_ERROR;
+ next_state = REVPARSE_STATE_DONE;
+ }
}
break;