mirror of
https://git.proxmox.com/git/libgit2
synced 2025-11-02 03:01:53 +00:00
test_helpers: do not rely on assert
The functions loose_object_mode and loose_object_dir_mode call stat inside an assert statement which isn't evaluated when compiling in Release mode (NDEBUG) and leads to failing tests. Replace it. Signed-off-by: schu <schu-github@schulog.org>
This commit is contained in:
parent
d3104fa0a3
commit
ec9079443c
@ -116,7 +116,8 @@ int loose_object_mode(const char *repository_folder, git_object *object)
|
||||
struct stat st;
|
||||
|
||||
locate_loose_object(repository_folder, object, &object_path, NULL);
|
||||
assert(p_stat(object_path, &st) == 0);
|
||||
if (p_stat(object_path, &st) < 0)
|
||||
return 0;
|
||||
free(object_path);
|
||||
|
||||
return st.st_mode;
|
||||
@ -138,7 +139,8 @@ int loose_object_dir_mode(const char *repository_folder, git_object *object)
|
||||
}
|
||||
}
|
||||
|
||||
assert(p_stat(object_path, &st) == 0);
|
||||
if (p_stat(object_path, &st) < 0)
|
||||
return 0;
|
||||
free(object_path);
|
||||
|
||||
return st.st_mode;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user