mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 23:03:35 +00:00
Fix one error not reported in revparse
There are many paths through revparse that may return an error code without reporting an error, I believe. This fixes one of them. Because of the backtracking in revparse, it is pretty complicated to fix the others.
This commit is contained in:
parent
1a9e406c21
commit
f470b00b03
@ -17,7 +17,7 @@
|
|||||||
static int disambiguate_refname(git_reference **out, git_repository *repo, const char *refname)
|
static int disambiguate_refname(git_reference **out, git_repository *repo, const char *refname)
|
||||||
{
|
{
|
||||||
int error = 0, i;
|
int error = 0, i;
|
||||||
bool fallbackmode = true;
|
bool fallbackmode = true, foundvalid = false;
|
||||||
git_reference *ref;
|
git_reference *ref;
|
||||||
git_buf refnamebuf = GIT_BUF_INIT, name = GIT_BUF_INIT;
|
git_buf refnamebuf = GIT_BUF_INIT, name = GIT_BUF_INIT;
|
||||||
|
|
||||||
@ -49,6 +49,7 @@ static int disambiguate_refname(git_reference **out, git_repository *repo, const
|
|||||||
error = GIT_EINVALIDSPEC;
|
error = GIT_EINVALIDSPEC;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
foundvalid = true;
|
||||||
|
|
||||||
error = git_reference_lookup_resolved(&ref, repo, git_buf_cstr(&refnamebuf), -1);
|
error = git_reference_lookup_resolved(&ref, repo, git_buf_cstr(&refnamebuf), -1);
|
||||||
|
|
||||||
@ -63,6 +64,12 @@ static int disambiguate_refname(git_reference **out, git_repository *repo, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
if (error && !foundvalid) {
|
||||||
|
/* never found a valid reference name */
|
||||||
|
giterr_set(GITERR_REFERENCE,
|
||||||
|
"Could not use '%s' as valid reference name", git_buf_cstr(&name));
|
||||||
|
}
|
||||||
|
|
||||||
git_buf_free(&name);
|
git_buf_free(&name);
|
||||||
git_buf_free(&refnamebuf);
|
git_buf_free(&refnamebuf);
|
||||||
return error;
|
return error;
|
||||||
|
Loading…
Reference in New Issue
Block a user