mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-12 10:01:10 +00:00
parent
e963166019
commit
545b479a07
@ -126,13 +126,6 @@ static int revparse_lookup_object(git_object **out, git_repository *repo, const
|
||||
int error;
|
||||
git_reference *ref;
|
||||
|
||||
error = maybe_describe(out, repo, spec);
|
||||
if (!error)
|
||||
return 0;
|
||||
|
||||
if (error < 0 && error != GIT_ENOTFOUND)
|
||||
return error;
|
||||
|
||||
error = disambiguate_refname(&ref, repo, spec);
|
||||
if (!error) {
|
||||
error = git_object_lookup(out, repo, git_reference_target(ref), GIT_OBJ_ANY);
|
||||
@ -140,6 +133,13 @@ static int revparse_lookup_object(git_object **out, git_repository *repo, const
|
||||
return error;
|
||||
}
|
||||
|
||||
if (error < 0 && error != GIT_ENOTFOUND)
|
||||
return error;
|
||||
|
||||
error = maybe_describe(out, repo, spec);
|
||||
if (!error)
|
||||
return 0;
|
||||
|
||||
if (error < 0 && error != GIT_ENOTFOUND)
|
||||
return error;
|
||||
|
||||
|
@ -486,3 +486,38 @@ void test_refs_revparse__issue_994(void)
|
||||
git_reference_free(head);
|
||||
cl_git_sandbox_cleanup();
|
||||
}
|
||||
|
||||
/**
|
||||
* $ git rev-parse blah-7-gc47800c
|
||||
* c47800c7266a2be04c571c04d5a6614691ea99bd
|
||||
*
|
||||
* $ git rev-parse HEAD~3
|
||||
* 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
|
||||
*
|
||||
* $ git branch blah-7-gc47800c HEAD~3
|
||||
*
|
||||
* $ git rev-parse blah-7-gc47800c
|
||||
* 4a202b346bb0fb0db7eff3cffeb3c70babbd2045
|
||||
*/
|
||||
void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void)
|
||||
{
|
||||
git_repository *repo;
|
||||
git_reference *branch;
|
||||
git_object *target;
|
||||
char sha[GIT_OID_HEXSZ + 1];
|
||||
|
||||
repo = cl_git_sandbox_init("testrepo.git");
|
||||
|
||||
test_object_inrepo("blah-7-gc47800c", "c47800c7266a2be04c571c04d5a6614691ea99bd", repo);
|
||||
|
||||
cl_git_pass(git_revparse_single(&target, repo, "HEAD~3"));
|
||||
cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0));
|
||||
|
||||
git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target));
|
||||
|
||||
test_object_inrepo("blah-7-gc47800c", sha, repo);
|
||||
|
||||
git_reference_free(branch);
|
||||
git_object_free(target);
|
||||
cl_git_sandbox_cleanup();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user