Commit ec907944 by schu

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>
parent d3104fa0
...@@ -116,7 +116,8 @@ int loose_object_mode(const char *repository_folder, git_object *object) ...@@ -116,7 +116,8 @@ int loose_object_mode(const char *repository_folder, git_object *object)
struct stat st; struct stat st;
locate_loose_object(repository_folder, object, &object_path, NULL); 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); free(object_path);
return st.st_mode; return st.st_mode;
...@@ -138,7 +139,8 @@ int loose_object_dir_mode(const char *repository_folder, git_object *object) ...@@ -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); free(object_path);
return st.st_mode; return st.st_mode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment