Commit 72b86bae by Ben Straub

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. 
parent 92ad5a5c
......@@ -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;
......
......@@ -36,6 +36,8 @@ void test_refs_revparse__cleanup(void)
void test_refs_revparse__nonexistant_object(void)
{
cl_git_fail(git_revparse_single(&g_obj, g_repo, "this doesn't exist"));
cl_git_fail(git_revparse_single(&g_obj, g_repo, "this doesn't exist^1"));
cl_git_fail(git_revparse_single(&g_obj, g_repo, "this doesn't exist~2"));
}
void test_refs_revparse__shas(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment