Branch Coverage

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


line true false branch
27 54 0 assert(out && repo);
0 54 assert(out && repo);
30 0 54 GIT_ERROR_CHECK_ALLOC(db);
44 54 0 assert(out && repo);
0 54 assert(out && repo);
48 0 54 if (git_refdb_new(&db, repo) < 0)
52 0 54 if (git_refdb_backend_fs(&dir, repo) < 0) {
66 49 0 if (db->backend)
72 0 0 GIT_ERROR_CHECK_VERSION(backend, GIT_REFDB_BACKEND_VERSION, "git_refdb_backend");
74 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 ||
75 0 0 !backend->write || !backend->rename || !backend->del ||
0 0 !backend->write || !backend->rename || !backend->del ||
0 0 !backend->write || !backend->rename || !backend->del ||
76 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 ||
77 0 0 !backend->reflog_read || !backend->reflog_write ||
0 0 !backend->reflog_read || !backend->reflog_write ||
78 0 0 !backend->reflog_rename || !backend->reflog_delete ||
0 0 !backend->reflog_rename || !backend->reflog_delete ||
79 0 0 (backend->lock && !backend->unlock)) {
92 0 0 assert(db);
94 0 0 if (db->backend->compress)
109 0 135 if (db == NULL)
112 48 87 GIT_REFCOUNT_DEC(db, git_refdb__free);
48 0 GIT_REFCOUNT_DEC(db, git_refdb__free);
117 0 0 assert(exists && refdb && refdb->backend);
0 0 assert(exists && refdb && refdb->backend);
0 0 assert(exists && refdb && refdb->backend);
127 1185 0 assert(db && db->backend && out && ref_name);
1185 0 assert(db && db->backend && out && ref_name);
1185 0 assert(db && db->backend && out && ref_name);
0 1185 assert(db && db->backend && out && ref_name);
130 135 1050 if (error < 0)
151 0 1048 if (max_nesting > MAX_NESTING_LEVEL)
153 590 458 else if (max_nesting < 0)
156 129 919 if ((error = git_refdb_lookup(&ref, db, ref_name)) < 0)
159 566 422 for (nesting = 0; nesting < max_nesting; nesting++) {
162 491 75 if (ref->type == GIT_REFERENCE_DIRECT)
165 6 69 if ((error = git_refdb_lookup(&resolved, db, git_reference_symbolic_target(ref))) < 0) {
167 6 0 if (error == GIT_ENOTFOUND) {
179 328 585 if (ref->type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
0 328 if (ref->type != GIT_REFERENCE_DIRECT && max_nesting != 0) {
197 32 0 if (!db->backend || !db->backend->iterator) {
0 32 if (!db->backend || !db->backend->iterator) {
202 0 32 if ((error = db->backend->iterator(out, db->backend, glob)) < 0)
215 8 11 if ((error = iter->next(out, iter)) < 0)
231 0 32 GIT_REFCOUNT_DEC(iter->db, git_refdb__free);
0 0 GIT_REFCOUNT_DEC(iter->db, git_refdb__free);
237 99 0 assert(db && db->backend);
0 99 assert(db && db->backend);
256 1 0 assert(db && db->backend);
0 1 assert(db && db->backend);
258 0 1 if (error < 0)
261 1 0 if (out) {
271 6 0 assert(db && db->backend);
0 6 assert(db && db->backend);
279 20 0 assert(db && db->backend);
0 20 assert(db && db->backend);
281 0 20 if ((error = db->backend->reflog_read(out, db->backend, name)) < 0)
295 0 90 if (error < 0)
299 2 88 if (logall == GIT_LOGALLREFUPDATES_UNSET)
312 10 19 *out = git_refdb_has_log(db, ref->name) ||
313 10 0 !git__prefixcmp(ref->name, GIT_REFS_HEADS_DIR) ||
314 10 0 !git__strcmp(ref->name, GIT_HEAD_FILE) ||
315 29 59 !git__prefixcmp(ref->name, GIT_REFS_REMOTES_DIR) ||
2 8 !git__prefixcmp(ref->name, GIT_REFS_REMOTES_DIR) ||
335 18 62 if (ref->type == GIT_REFERENCE_SYMBOLIC) {
340 0 62 if ((error = git_refdb_lookup(&head, db, GIT_HEAD_FILE)) < 0)
343 4 58 if (git_reference_type(head) == GIT_REFERENCE_DIRECT)
347 3 55 if ((error = git_refdb_resolve(&resolved, db, git_reference_symbolic_target(head), -1)) < 0) {
348 0 3 if (error != GIT_ENOTFOUND)
352 0 55 } else if (git_reference_type(resolved) == GIT_REFERENCE_SYMBOLIC) {
358 28 30 if (strcmp(name, ref->name))
371 88 0 assert(db && refname);
0 88 assert(db && refname);
378 6 0 assert(db && refname);
0 6 assert(db && refname);
385 0 54 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
392 3 0 assert(payload && db && refname);
3 0 assert(payload && db && refname);
0 3 assert(payload && db && refname);
394 0 3 if (!db->backend->lock) {
404 0 3 assert(db);