Branch Coverage

deps/libgit2/src/libgit2/refdb.c
Criterion Covered Total %
branch 82 174 47.1


line true false branch
27 0 54 GIT_ASSERT_ARG(out);
28 0 54 GIT_ASSERT_ARG(repo);
31 0 54 GIT_ERROR_CHECK_ALLOC(db);
45 0 54 GIT_ASSERT_ARG(out);
46 0 54 GIT_ASSERT_ARG(repo);
50 0 54 if (git_refdb_new(&db, repo) < 0)
54 0 54 if (git_refdb_backend_fs(&dir, repo) < 0) {
68 51 0 if (db->backend)
74 0 0 GIT_ERROR_CHECK_VERSION(backend, GIT_REFDB_BACKEND_VERSION, "git_refdb_backend");
76 0 0 if (!backend->exists || !backend->lookup || !backend->iterator ||
0 0 if (!backend->exists || !backend->lookup || !backend->iterator ||
0 0 if (!backend->exists || !backend->lookup || !backend->iterator ||
0 0 if (!backend->exists || !backend->lookup || !backend->iterator ||
77 0 0 !backend->write || !backend->rename || !backend->del ||
0 0 !backend->write || !backend->rename || !backend->del ||
0 0 !backend->write || !backend->rename || !backend->del ||
78 0 0 !backend->has_log || !backend->ensure_log || !backend->free ||
0 0 !backend->has_log || !backend->ensure_log || !backend->free ||
0 0 !backend->has_log || !backend->ensure_log || !backend->free ||
79 0 0 !backend->reflog_read || !backend->reflog_write ||
0 0 !backend->reflog_read || !backend->reflog_write ||
80 0 0 !backend->reflog_rename || !backend->reflog_delete ||
0 0 !backend->reflog_rename || !backend->reflog_delete ||
81 0 0 (backend->lock && !backend->unlock)) {
94 0 0 GIT_ASSERT_ARG(db);
96 0 0 if (db->backend->compress)
111 0 137 if (db == NULL)
114 50 87 GIT_REFCOUNT_DEC(db, git_refdb__free);
50 0 GIT_REFCOUNT_DEC(db, git_refdb__free);
119 0 0 GIT_ASSERT_ARG(exists);
120 0 0 GIT_ASSERT_ARG(refdb);
121 0 0 GIT_ASSERT_ARG(refdb->backend);
131 0 1185 GIT_ASSERT_ARG(db);
132 0 1185 GIT_ASSERT_ARG(db->backend);
133 0 1185 GIT_ASSERT_ARG(out);
134 0 1185 GIT_ASSERT_ARG(ref_name);
137 135 1050 if (error < 0)
158 0 1048 if (max_nesting > MAX_NESTING_LEVEL)
160 590 458 else if (max_nesting < 0)
163 129 919 if ((error = git_refdb_lookup(&ref, db, ref_name)) < 0)
166 566 422 for (nesting = 0; nesting < max_nesting; nesting++) {
169 491 75 if (ref->type == GIT_REFERENCE_DIRECT)
172 6 69 if ((error = git_refdb_lookup(&resolved, db, git_reference_symbolic_target(ref))) < 0) {
174 6 0 if (error == GIT_ENOTFOUND) {
186 328 585 if (ref->type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
0 328 if (ref->type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
204 31 0 if (!db->backend || !db->backend->iterator) {
0 31 if (!db->backend || !db->backend->iterator) {
209 0 31 if ((error = db->backend->iterator(out, db->backend, glob)) < 0)
222 8 11 if ((error = iter->next(out, iter)) < 0)
238 0 31 GIT_REFCOUNT_DEC(iter->db, git_refdb__free);
0 0 GIT_REFCOUNT_DEC(iter->db, git_refdb__free);
244 0 99 GIT_ASSERT_ARG(db);
245 0 99 GIT_ASSERT_ARG(db->backend);
264 0 1 GIT_ASSERT_ARG(db);
265 0 1 GIT_ASSERT_ARG(db->backend);
268 0 1 if (error < 0)
271 1 0 if (out) {
281 0 6 GIT_ASSERT_ARG(db);
282 0 6 GIT_ASSERT_ARG(db->backend);
291 0 20 GIT_ASSERT_ARG(db);
292 0 20 GIT_ASSERT_ARG(db->backend);
294 0 20 if ((error = db->backend->reflog_read(out, db->backend, name)) < 0)
308 0 90 if (error < 0)
312 2 88 if (logall == GIT_LOGALLREFUPDATES_UNSET)
325 10 19 *out = git_refdb_has_log(db, ref->name) ||
326 10 0 !git__prefixcmp(ref->name, GIT_REFS_HEADS_DIR) ||
327 10 0 !git__strcmp(ref->name, GIT_HEAD_FILE) ||
328 29 59 !git__prefixcmp(ref->name, GIT_REFS_REMOTES_DIR) ||
2 8 !git__prefixcmp(ref->name, GIT_REFS_REMOTES_DIR) ||
348 18 62 if (ref->type == GIT_REFERENCE_SYMBOLIC) {
353 0 62 if ((error = git_refdb_lookup(&head, db, GIT_HEAD_FILE)) < 0)
356 4 58 if (git_reference_type(head) == GIT_REFERENCE_DIRECT)
360 3 55 if ((error = git_refdb_resolve(&resolved, db, git_reference_symbolic_target(head), -1)) < 0) {
361 0 3 if (error != GIT_ENOTFOUND)
365 0 55 } else if (git_reference_type(resolved) == GIT_REFERENCE_SYMBOLIC) {
371 28 30 if (strcmp(name, ref->name))
384 0 88 GIT_ASSERT_ARG(db);
385 0 88 GIT_ASSERT_ARG(refname);
392 0 6 GIT_ASSERT_ARG(db);
393 0 6 GIT_ASSERT_ARG(refname);
400 0 54 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
407 0 3 GIT_ASSERT_ARG(payload);
408 0 3 GIT_ASSERT_ARG(db);
409 0 3 GIT_ASSERT_ARG(refname);
411 0 3 if (!db->backend->lock) {
421 0 3 GIT_ASSERT_ARG(db);