Unverified Commit 4efd6563 by Edward Thomson Committed by GitHub

Merge pull request #6196 from libgit2/ethomson/at_revparse

revparse: support bare '@'
parents 8d967d85 add2dabb
...@@ -799,6 +799,9 @@ static int revparse( ...@@ -799,6 +799,9 @@ static int revparse(
if (temp_object != NULL) if (temp_object != NULL)
base_rev = temp_object; base_rev = temp_object;
break; break;
} else if (spec[pos+1] == '\0') {
spec = "HEAD";
break;
} }
/* fall through */ /* fall through */
......
...@@ -881,3 +881,10 @@ void test_refs_revparse__uneven_sizes(void) ...@@ -881,3 +881,10 @@ void test_refs_revparse__uneven_sizes(void)
test_object("a65fedf39aefe402d3bb6e24df4d", test_object("a65fedf39aefe402d3bb6e24df4d",
"a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
} }
void test_refs_revparse__parses_at_head(void)
{
test_id("HEAD", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", NULL, GIT_REVSPEC_SINGLE);
test_id("@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", NULL, GIT_REVSPEC_SINGLE);
test_id("@", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", NULL, GIT_REVSPEC_SINGLE);
}
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