Branch Coverage

deps/libgit2/src/branch.c
Criterion Covered Total %
branch 47 210 22.3


line true false branch
32 1 14 prefix = is_remote ? GIT_REFS_REMOTES_DIR : GIT_REFS_HEADS_DIR;
34 15 0 if ((error = git_buf_joinpath(&ref_name, prefix, branch_name)) < 0)
36 2 13 else if ((error = git_reference_lookup(&branch, repo, ref_name.ptr)) < 0)
37 1 1 git_error_set(
70 16 0 assert(branch_name && commit && ref_out);
16 0 assert(branch_name && commit && ref_out);
0 16 assert(branch_name && commit && ref_out);
71 0 16 assert(git_object_owner((const git_object *)commit) == repository);
73 0 16 if (!git__strcmp(branch_name, "HEAD")) {
79 0 16 if (force && !bare && git_branch_lookup(&branch, repository, branch_name, GIT_BRANCH_LOCAL) == 0) {
0 0 if (force && !bare && git_branch_lookup(&branch, repository, branch_name, GIT_BRANCH_LOCAL) == 0) {
0 0 if (force && !bare && git_branch_lookup(&branch, repository, branch_name, GIT_BRANCH_LOCAL) == 0) {
84 0 0 if (error < 0)
90 0 16 if (is_unmovable_head && force) {
0 0 if (is_unmovable_head && force) {
97 0 16 if (git_buf_joinpath(&canonical_branch_name, GIT_REFS_HEADS_DIR, branch_name) < 0)
100 0 16 if (git_buf_printf(&log_message, "branch: Created from %s", from) < 0)
107 16 0 if (!error)
143 0 17 if (git_repository_is_bare(worktree))
146 0 17 if ((error = git_reference_lookup(&head, worktree, GIT_HEAD_FILE)) < 0) {
147 0 0 if (error == GIT_ENOTFOUND)
152 0 17 if (git_reference_type(head) != GIT_REFERENCE_SYMBOLIC)
164 0 17 if (!git_reference_is_branch(branch))
176 0 0 assert(branch);
178 0 0 if (!git_reference_is_branch(branch) && !git_reference_is_remote(branch)) {
0 0 if (!git_reference_is_branch(branch) && !git_reference_is_remote(branch)) {
184 0 0 if ((is_head = git_branch_is_head(branch)) < 0)
187 0 0 if (is_head) {
193 0 0 if (git_reference_is_branch(branch) && git_branch_is_checked_out(branch)) {
0 0 if (git_reference_is_branch(branch) && git_branch_is_checked_out(branch)) {
199 0 0 if (git_buf_join(&config_section, '.', "branch",
203 0 0 if (git_config_rename_section(
225 6 2 while ((error = git_reference_next(&ref, iter->iter)) == 0) {
254 0 2 GIT_ERROR_CHECK_ALLOC(iter);
258 0 2 if (git_reference_iterator_new(&iter->iter, repo) < 0) {
272 0 2 if (iter == NULL)
291 1 0 assert(branch && new_branch_name);
0 1 assert(branch && new_branch_name);
293 0 1 if (!git_reference_is_branch(branch))
296 0 1 if ((error = git_buf_joinpath(&new_reference_name, GIT_REFS_HEADS_DIR, new_branch_name)) < 0)
299 0 1 if ((error = git_buf_printf(&log_message, "branch: renamed %s to %s",
308 0 1 if (error < 0)
336 15 0 assert(ref_out && repo && branch_name);
15 0 assert(ref_out && repo && branch_name);
0 15 assert(ref_out && repo && branch_name);
345 0 0 if (error == GIT_ENOTFOUND)
360 0 0 assert(out && ref);
0 0 assert(out && ref);
364 0 0 if (git_reference_is_branch(ref)) {
366 0 0 } else if (git_reference_is_remote(ref)) {
386 0 4 if (git_buf_printf(&buf, format,
408 4 0 assert(out && refname);
0 4 assert(out && refname);
412 0 4 if (!git_reference__is_branch(refname))
415 0 4 if ((error = git_repository_config_snapshot(&config, repo)) < 0)
418 4 0 if ((error = retrieve_upstream_configuration(
422 0 0 if ((error = retrieve_upstream_configuration(
426 0 0 if (git_buf_len(&remote_name) == 0 || git_buf_len(&merge_name) == 0) {
0 0 if (git_buf_len(&remote_name) == 0 || git_buf_len(&merge_name) == 0) {
433 0 0 if (strcmp(".", git_buf_cstr(&remote_name)) != 0) {
434 0 0 if ((error = git_remote_lookup(&remote, repo, git_buf_cstr(&remote_name))) < 0)
438 0 0 if (!refspec) {
443 0 0 if (git_refspec_transform(&buf, refspec, git_buf_cstr(&merge_name)) < 0)
446 0 0 if (git_buf_set(&buf, git_buf_cstr(&merge_name), git_buf_len(&merge_name)) < 0)
465 0 0 if (!git_reference__is_branch(refname))
468 0 0 if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
473 0 0 if ((error = retrieve_upstream_configuration(buf, cfg, refname, "branch.%s.remote")) < 0)
476 0 0 if (git_buf_len(buf) == 0) {
494 0 0 assert(buf && repo && refname);
0 0 assert(buf && repo && refname);
0 0 assert(buf && repo && refname);
499 0 0 if (!git_reference__is_remote(refname)) {
507 0 0 if ((error = git_remote_list(&remote_list, repo)) < 0)
511 0 0 for (i = 0; i < remote_list.count; i++) {
512 0 0 if ((error = git_remote_lookup(&remote, repo, remote_list.strings[i])) < 0)
516 0 0 if (fetchspec) {
521 0 0 if (!remote_name) {
536 0 0 if (remote_name) {
546 0 0 if (error < 0)
560 2 0 if ((error = git_branch_upstream_name(&tracking_name,
577 0 0 if (git_buf_printf(&buf, "branch.%s.remote", shortname) < 0)
580 0 0 if (git_config_delete_entry(config, git_buf_cstr(&buf)) < 0)
584 0 0 if (git_buf_printf(&buf, "branch.%s.merge", shortname) < 0)
587 0 0 if (git_config_delete_entry(config, git_buf_cstr(&buf)) < 0)
610 0 0 if (!git_reference__is_branch(refname))
613 0 0 if (git_repository_config__weakptr(&config, git_reference_owner(branch)) < 0)
619 0 0 if (branch_name == NULL)
625 0 0 if (git_branch_lookup(&upstream, repo, branch_name, GIT_BRANCH_LOCAL) == 0)
627 0 0 else if (git_branch_lookup(&upstream, repo, branch_name, GIT_BRANCH_REMOTE) == 0)
641 0 0 if (local)
646 0 0 if (error < 0)
650 0 0 if (git_buf_printf(&key, "branch.%s.remote", shortname) < 0)
653 0 0 if (git_config_set_string(config, git_buf_cstr(&key), git_buf_cstr(&remote_name)) < 0)
656 0 0 if (local) {
658 0 0 if (git_buf_puts(&merge_refspec, git_reference_name(upstream)) < 0)
662 0 0 if (git_remote_lookup(&remote, repo, git_buf_cstr(&remote_name)) < 0)
666 0 0 if (!fetchspec || git_refspec_rtransform(&merge_refspec, fetchspec, git_reference_name(upstream)) < 0)
0 0 if (!fetchspec || git_refspec_rtransform(&merge_refspec, fetchspec, git_reference_name(upstream)) < 0)
675 0 0 if (git_buf_printf(&key, "branch.%s.merge", shortname) < 0)
678 0 0 if (git_config_set_string(config, git_buf_cstr(&key), git_buf_cstr(&merge_refspec)) < 0)
705 0 1 assert(branch);
707 0 1 if (!git_reference_is_branch(branch))
712 1 0 if (error == GIT_EUNBORNBRANCH || error == GIT_ENOTFOUND)
0 1 if (error == GIT_EUNBORNBRANCH || error == GIT_ENOTFOUND)
715 0 1 if (error < 0)