Branch Coverage

deps/libgit2/src/notes.c
Criterion Covered Total %
branch 74 158 46.8


line true false branch
35 2 14 if (parent == NULL)
38 10 4 for (i = 0; i < git_tree_entrycount(parent); i++) {
41 0 10 if (!git__ishex(git_tree_entry_name(entry)))
44 0 10 if (S_ISDIR(git_tree_entry_filemode(entry))
45 0 0 && strlen(git_tree_entry_name(entry)) == 2
46 0 0 && !strncmp(git_tree_entry_name(entry), annotated_object_sha + fanout, 2))
50 10 0 if (!strcmp(git_tree_entry_name(entry), annotated_object_sha + fanout))
66 6 2 if (error == GIT_EEXISTS)
69 2 0 if (error < 0)
84 6 0 for (i=0; i
87 6 0 if (!strcmp(git_tree_entry_name(entry), target)) {
111 0 5 if ((error = git_treebuilder_new(&tb, repo, source_tree)) < 0)
114 3 2 if (object_oid) {
115 0 3 if ((error = git_treebuilder_insert(
119 0 2 if ((error = git_treebuilder_remove(tb, treeentry_name)) < 0)
123 0 5 if ((error = git_treebuilder_write(&tree_oid, tb)) < 0)
164 4 4 if (error == GIT_EEXISTS) {
170 4 0 if (error == GIT_ENOTFOUND) {
176 0 0 if (error < 0)
184 0 0 if (error < 0)
291 0 4 if ((error = git_blob_create_from_buffer(&oid, repo, note, strlen(note))) < 0)
294 1 3 if ((error = manipulate_note_in_tree_r(
1 3 if ((error = manipulate_note_in_tree_r(
300 3 0 if (notes_blob_out)
308 3 0 if (notes_commit_out)
326 0 6 GIT_ERROR_CHECK_ALLOC(note);
335 0 6 GIT_ERROR_CHECK_BLOBSIZE(blobsize);
338 0 6 GIT_ERROR_CHECK_ALLOC(note->message);
357 2 6 if ((error = find_subtree_r(&subtree, tree, repo, target, &fanout)) < 0)
360 0 6 if ((error = find_blob(&oid, subtree, target + fanout)) < 0)
363 0 6 if ((error = git_blob_lookup(&blob, repo, &oid)) < 0)
366 0 6 if ((error = note_new(¬e, &oid, commit, blob)) < 0)
388 2 2 if ((error = manipulate_note_in_tree_r(
399 0 2 if (error < 0)
402 2 0 if (notes_commit_out)
415 12 0 *out = (ret != 0) ? NULL : git_config__get_string_force(
423 7 10 if (notes_ref) {
425 0 7 GIT_ERROR_CHECK_ALLOC(*out);
441 0 17 if ((error = normalize_namespace(notes_ref_out, repo, notes_ref)) < 0)
444 3 14 if ((error = git_reference_name_to_id(&oid, repo, *notes_ref_out)) < 0)
447 0 14 if (git_commit_lookup(commit_out, repo, &oid) < 0)
465 0 8 if ((error = git_commit_tree(&tree, notes_commit)) < 0)
484 0 8 if (error < 0)
512 2 2 if (parent != NULL && (error = git_commit_tree(&tree, parent)) < 0)
0 2 if (parent != NULL && (error = git_commit_tree(&tree, parent)) < 0)
518 1 3 if (error < 0)
545 3 2 if (error < 0 && error != GIT_ENOTFOUND)
1 2 if (error < 0 && error != GIT_ENOTFOUND)
553 1 3 if (error < 0)
559 0 3 if (out != NULL)
583 0 4 if ((error = git_commit_tree(&tree, notes_commit)) < 0)
607 0 4 if (error < 0)
612 2 2 if (error < 0)
630 2 0 assert(out && repo);
0 2 assert(out && repo);
634 0 2 if ((error = note_get_default_ref(&default_ref, repo)) < 0)
643 0 1 assert(note);
649 0 1 assert(note);
655 0 3 assert(note);
661 0 3 assert(note);
667 0 6 if (note == NULL)
684 0 0 if ((error = git_buf_puts(&buf, entry_path)) < 0)
689 0 0 while (i < len) {
690 0 0 if (buf.ptr[i] == '/') {
695 0 0 if (git__fromhex(buf.ptr[i]) < 0) {
700 0 0 if (i != j)
710 0 0 if (j != GIT_OID_HEXSZ) {
732 0 0 if ((error = git_note_iterator_new(&iter, repo, notes_ref)) < 0)
735 0 0 while (!(error = git_note_next(¬e_id, &annotated_id, iter))) {
736 0 0 if ((error = note_cb(¬e_id, &annotated_id, payload)) != 0) {
742 0 0 if (error == GIT_ITEROVER)
751 0 0 if (it == NULL)
764 0 0 if ((error = git_commit_tree(&tree, notes_commit)) < 0)
767 0 0 if ((error = git_iterator_for_tree(it, tree, NULL)) < 0)
786 0 0 if (error < 0)
806 0 0 if ((error = git_iterator_current(&item, it)) < 0)
811 0 0 if ((error = process_entry_path(item->path, annotated_id)) < 0)
814 0 0 if ((error = git_iterator_advance(NULL, it)) < 0 && error != GIT_ITEROVER)
0 0 if ((error = git_iterator_advance(NULL, it)) < 0 && error != GIT_ITEROVER)