Commit 3b43c9d3 by Edward Thomson

Merge branch 'revparse'

parents 632fe77d c1634611
......@@ -268,7 +268,16 @@ static int retrieve_revobject_from_reflog(git_object **out, git_reference **base
int error = -1;
if (*base_ref == NULL) {
if ((error = git_reference_dwim(&ref, repo, identifier)) < 0)
/*
* When HEAD@{n} is specified, do not use dwim, which would resolve the
* reference (to the current branch that HEAD is pointing to).
*/
if (position > 0 && strcmp(identifier, GIT_HEAD_FILE) == 0)
error = git_reference_lookup(&ref, repo, GIT_HEAD_FILE);
else
error = git_reference_dwim(&ref, repo, identifier);
if (error < 0)
return error;
} else {
ref = *base_ref;
......
......@@ -304,6 +304,9 @@ void test_refs_revparse__ordinal(void)
test_object("@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
test_object("@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
test_object("HEAD@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
test_object("HEAD@{4}", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
test_object("master@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
test_object("master@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
test_object("heads/master@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
......
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