Commit 3b83bdac392a66bcacd2fc196bf47b07e07829de

Vicent Martí 2011-11-07T06:25:22

Merge pull request #470 from schu/test-helpers-no-assert test_helpers: do not rely on assert

diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index 47a0b1b..31e38bf 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -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;