make the read_log() tests fail if some objects cannot be read
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/regress/repository/repository_test.c b/regress/repository/repository_test.c
index 5ca8cd8..ac7b326 100644
--- a/regress/repository/repository_test.c
+++ b/regress/repository/repository_test.c
@@ -39,7 +39,7 @@ print_parent_commits(struct got_commit_object *commit,
struct got_repository *repo)
{
struct got_parent_id *pid;
- const struct got_error *err;
+ const struct got_error *err = NULL;
struct got_object *obj;
SIMPLEQ_FOREACH(pid, &commit->parent_ids, entry) {
@@ -48,11 +48,11 @@ print_parent_commits(struct got_commit_object *commit,
return err;
if (got_object_get_type(obj) != GOT_OBJ_TYPE_COMMIT)
return got_error(GOT_ERR_OBJ_TYPE);
- print_commit_object(obj, repo);
+ err = print_commit_object(obj, repo);
got_object_close(obj);
}
- return NULL;
+ return err;
}
static const struct got_error *
@@ -175,8 +175,12 @@ repo_read_log(const char *repo_path)
err = got_object_open(&obj, repo, id);
if (err != NULL || obj == NULL)
return 0;
- if (got_object_get_type(obj) == GOT_OBJ_TYPE_COMMIT)
- print_commit_object(obj, repo);
+ if (got_object_get_type(obj) == GOT_OBJ_TYPE_COMMIT) {
+ err = print_commit_object(obj, repo);
+ if (err)
+ return 0;
+ } else
+ return 0;
got_object_close(obj);
free(id);
got_ref_close(head_ref);