revparse: unfound nth parent returns ENOTFOUND
diff --git a/src/revparse.c b/src/revparse.c
index dd3886e..5050bdf 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -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) {
- return GIT_ERROR;
+ return GIT_ENOTFOUND;
}
*out = (git_object*)commit;
diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c
index e2e82cf..c71e6d8 100644
--- a/tests-clar/refs/revparse.c
+++ b/tests-clar/refs/revparse.c
@@ -85,6 +85,8 @@ void test_refs_revparse__nth_parent(void)
test_object("be3563a^1^1", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045");
test_object("be3563a^2^1", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
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)