tree: add more correct error messages for not found Don't use the full path, as that's not what we are asserting does not exist, but just the subpath we were looking up.
diff --git a/src/tree.c b/src/tree.c
index 47ed20d..bdd1766 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -858,7 +858,7 @@ int git_tree_entry_bypath(
if (entry == NULL) {
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", filename_len, path);
return GIT_ENOTFOUND;
}
@@ -868,7 +868,7 @@ int git_tree_entry_bypath(
* then this entry *must* be a tree */
if (!git_tree_entry__is_tree(entry)) {
giterr_set(GITERR_TREE,
- "The path '%s' does not exist in the given tree", path);
+ "the path '%.*s' exists but is not a tree", filename_len, path);
return GIT_ENOTFOUND;
}