Commit 08ac23a5 by nulltoken

revparse: unfound reflog ref returns ENOTFOUND

parent 4de89ce7
...@@ -29,9 +29,10 @@ static void set_invalid_syntax_err(const char *spec) ...@@ -29,9 +29,10 @@ 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_oid resolved; git_oid resolved;
int error;
if (git_reference_name_to_oid(&resolved, repo, spec) < 0) if ((error = git_reference_name_to_oid(&resolved, repo, spec)) < 0)
return GIT_ERROR; return error;
return git_object_lookup(out, repo, &resolved, GIT_OBJ_ANY); return git_object_lookup(out, repo, &resolved, GIT_OBJ_ANY);
} }
......
...@@ -128,6 +128,8 @@ void test_refs_revparse__reflog(void) ...@@ -128,6 +128,8 @@ void test_refs_revparse__reflog(void)
cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{-0}")); cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{-0}"));
cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{1000}")); cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{1000}"));
cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "nope@{0}"));
test_object("@{-2}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); test_object("@{-2}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
test_object("@{-1}", "a4a7dce85cf63874e984719f4fdd239f5145052f"); test_object("@{-1}", "a4a7dce85cf63874e984719f4fdd239f5145052f");
test_object("master@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); test_object("master@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
......
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