mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 13:48:41 +00:00
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.
This commit is contained in:
parent
92ad5a5cda
commit
72b86bae50
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user