Commit c1634611 by Edward Thomson

revparse: comment reflog HEAD@{n} parsing

parent 0628e25d
...@@ -268,11 +268,16 @@ static int retrieve_revobject_from_reflog(git_object **out, git_reference **base ...@@ -268,11 +268,16 @@ static int retrieve_revobject_from_reflog(git_object **out, git_reference **base
int error = -1; int error = -1;
if (*base_ref == NULL) { if (*base_ref == NULL) {
if (position > 0 && /*
(!strcmp(identifier, "HEAD"))) { * When HEAD@{n} is specified, do not use dwim, which would resolve the
if ((error = git_reference_lookup(&ref, repo, "HEAD")) < 0) * reference (to the current branch that HEAD is pointing to).
return error; */
} else if ((error = git_reference_dwim(&ref, repo, identifier)) < 0) 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; return error;
} else { } else {
ref = *base_ref; ref = *base_ref;
......
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