mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-11 08:16:35 +00:00
Simplifying revparse_lookup_fully_qualified_ref.
This commit is contained in:
parent
d13c1a8b60
commit
ec6a632a1b
@ -29,24 +29,12 @@ static void set_invalid_syntax_err(const char *spec)
|
|||||||
|
|
||||||
static int revparse_lookup_fully_qualifed_ref(git_object **out, git_repository *repo, const char*spec)
|
static int revparse_lookup_fully_qualifed_ref(git_object **out, git_repository *repo, const char*spec)
|
||||||
{
|
{
|
||||||
git_reference *ref;
|
git_oid resolved;
|
||||||
git_object *obj = NULL;
|
|
||||||
|
|
||||||
if (!git_reference_lookup(&ref, repo, spec)) {
|
if (git_reference_name_to_oid(&resolved, repo, spec) < 0)
|
||||||
git_reference *resolved_ref;
|
return GIT_ERROR;
|
||||||
if (!git_reference_resolve(&resolved_ref, ref)) {
|
|
||||||
if (!git_object_lookup(&obj, repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY)) {
|
|
||||||
*out = obj;
|
|
||||||
}
|
|
||||||
git_reference_free(resolved_ref);
|
|
||||||
}
|
|
||||||
git_reference_free(ref);
|
|
||||||
}
|
|
||||||
if (obj) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GIT_ERROR;
|
return git_object_lookup(out, repo, &resolved, GIT_OBJ_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int revparse_lookup_object(git_object **out, git_repository *repo, const char *spec)
|
static int revparse_lookup_object(git_object **out, git_repository *repo, const char *spec)
|
||||||
|
Loading…
Reference in New Issue
Block a user