mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-03 20:02:04 +00:00
tree: unfound tree entry returns GIT_ENOTFOUND
This commit is contained in:
parent
1c3edb3078
commit
dc1f4b32d3
@ -730,7 +730,7 @@ int git_tree_entry_bypath(
|
|||||||
if (!git_tree_entry__is_tree(entry)) {
|
if (!git_tree_entry__is_tree(entry)) {
|
||||||
giterr_set(GITERR_TREE,
|
giterr_set(GITERR_TREE,
|
||||||
"The path '%s' does not exist in the given tree", path);
|
"The path '%s' does not exist in the given tree", path);
|
||||||
return -1;
|
return GIT_ENOTFOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's only a slash left in the path, we
|
/* If there's only a slash left in the path, we
|
||||||
|
@ -46,12 +46,12 @@ void test_object_tree_frompath__retrieve_tree_from_path_to_treeentry(void)
|
|||||||
assert_tree_from_path(tree, "ab/", "ab");
|
assert_tree_from_path(tree, "ab/", "ab");
|
||||||
assert_tree_from_path(tree, "ab/de/", "de");
|
assert_tree_from_path(tree, "ab/de/", "de");
|
||||||
|
|
||||||
cl_must_fail(git_tree_entry_bypath(&e, tree, "i-do-not-exist.txt"));
|
cl_assert_equal_i(GIT_ENOTFOUND, git_tree_entry_bypath(&e, tree, "i-do-not-exist.txt"));
|
||||||
cl_must_fail(git_tree_entry_bypath(&e, tree, "README/"));
|
cl_assert_equal_i(GIT_ENOTFOUND, git_tree_entry_bypath(&e, tree, "README/"));
|
||||||
cl_must_fail(git_tree_entry_bypath(&e, tree, "ab/de/fgh/i-do-not-exist.txt"));
|
cl_assert_equal_i(GIT_ENOTFOUND, git_tree_entry_bypath(&e, tree, "ab/de/fgh/i-do-not-exist.txt"));
|
||||||
cl_must_fail(git_tree_entry_bypath(&e, tree, "nope/de/fgh/1.txt"));
|
cl_assert_equal_i(GIT_ENOTFOUND, git_tree_entry_bypath(&e, tree, "nope/de/fgh/1.txt"));
|
||||||
cl_must_fail(git_tree_entry_bypath(&e, tree, "ab/me-neither/fgh/2.txt"));
|
cl_assert_equal_i(GIT_ENOTFOUND, git_tree_entry_bypath(&e, tree, "ab/me-neither/fgh/2.txt"));
|
||||||
cl_must_fail(git_tree_entry_bypath(&e, tree, "ab/me-neither/fgh/2.txt/"));
|
cl_assert_equal_i(GIT_ENOTFOUND, git_tree_entry_bypath(&e, tree, "ab/me-neither/fgh/2.txt/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_object_tree_frompath__fail_when_processing_an_invalid_path(void)
|
void test_object_tree_frompath__fail_when_processing_an_invalid_path(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user