mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 03:15:46 +00:00
refs: deep unfound ref returns ENOTFOUND
This commit is contained in:
parent
5ffd510dd2
commit
d0a920a6fd
@ -94,7 +94,7 @@ int git_futils_open_ro(const char *path)
|
|||||||
{
|
{
|
||||||
int fd = p_open(path, O_RDONLY);
|
int fd = p_open(path, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT || errno == ENOTDIR)
|
||||||
fd = GIT_ENOTFOUND;
|
fd = GIT_ENOTFOUND;
|
||||||
giterr_set(GITERR_OS, "Failed to open '%s'", path);
|
giterr_set(GITERR_OS, "Failed to open '%s'", path);
|
||||||
}
|
}
|
||||||
|
@ -192,3 +192,13 @@ void test_refs_read__loose_first(void)
|
|||||||
|
|
||||||
git_reference_free(reference);
|
git_reference_free(reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_refs_read__unfound_return_ENOTFOUND(void)
|
||||||
|
{
|
||||||
|
git_reference *reference;
|
||||||
|
|
||||||
|
cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&reference, g_repo, "test/master"));
|
||||||
|
cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&reference, g_repo, "refs/test/master"));
|
||||||
|
cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&reference, g_repo, "refs/tags/test/master"));
|
||||||
|
cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&reference, g_repo, "refs/tags/test/farther/master"));
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user