Commit 0e7af9e7 by nulltoken

revparse: unfound nth parent returns ENOTFOUND

parent 0d23c62c
...@@ -485,7 +485,7 @@ static int handle_caret_syntax(git_object **out, git_repository *repo, git_objec ...@@ -485,7 +485,7 @@ static int handle_caret_syntax(git_object **out, git_repository *repo, git_objec
} }
if (git_commit_parent(&commit, commit, n-1) < 0) { if (git_commit_parent(&commit, commit, n-1) < 0) {
return GIT_ERROR; return GIT_ENOTFOUND;
} }
*out = (git_object*)commit; *out = (git_object*)commit;
......
...@@ -85,6 +85,8 @@ void test_refs_revparse__nth_parent(void) ...@@ -85,6 +85,8 @@ void test_refs_revparse__nth_parent(void)
test_object("be3563a^1^1", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045"); test_object("be3563a^1^1", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045");
test_object("be3563a^2^1", "5b5b025afb0b4c913b4c338a42934a3863bf3644"); test_object("be3563a^2^1", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
test_object("be3563a^0", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); test_object("be3563a^0", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
cl_assert_equal_i(GIT_ENOTFOUND, git_revparse_single(&g_obj, g_repo, "be3563a^42"));
} }
void test_refs_revparse__not_tag(void) void test_refs_revparse__not_tag(void)
......
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