Branch Coverage

deps/libgit2/src/branch.c
Criterion Covered Total %
branch 46 206 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)
159 0 17 assert(branch);
161 0 17 if (!git_reference_is_branch(branch))
166 0 17 if (git_repository_is_bare(repo))
178 0 0 assert(branch);
180 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)) {
186 0 0 if ((is_head = git_branch_is_head(branch)) < 0)
189 0 0 if (is_head) {
195 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)) {
201 0 0 if (git_buf_join(&config_section, '.', "branch",
205 0 0 if (git_config_rename_section(
227 6 2 while ((error = git_reference_next(&ref, iter->iter)) == 0) {
256 0 2 GIT_ERROR_CHECK_ALLOC(iter);
260 0 2 if (git_reference_iterator_new(&iter->iter, repo) < 0) {
274 0 2 if (iter == NULL)
293 1 0 assert(branch && new_branch_name);
0 1 assert(branch && new_branch_name);
295 0 1 if (!git_reference_is_branch(branch))
298 0 1 if ((error = git_buf_joinpath(&new_reference_name, GIT_REFS_HEADS_DIR, new_branch_name)) < 0)
301 0 1 if ((error = git_buf_printf(&log_message, "branch: renamed %s to %s",
310 0 1 if (error < 0)
338 15 0 assert(ref_out && repo && branch_name);
15 0 assert(ref_out && repo && branch_name);
0 15 assert(ref_out && repo && branch_name);
347 0 0 if (error == GIT_ENOTFOUND)
362 0 0 assert(out && ref);
0 0 assert(out && ref);
366 0 0 if (git_reference_is_branch(ref)) {
368 0 0 } else if (git_reference_is_remote(ref)) {
388 0 4 if (git_buf_printf(&buf, format,
410 4 0 assert(out && refname);
0 4 assert(out && refname);
414 0 4 if (!git_reference__is_branch(refname))
417 0 4 if ((error = git_repository_config_snapshot(&config, repo)) < 0)
420 4 0 if ((error = retrieve_upstream_configuration(
424 0 0 if ((error = retrieve_upstream_configuration(
428 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) {
435 0 0 if (strcmp(".", git_buf_cstr(&remote_name)) != 0) {
436 0 0 if ((error = git_remote_lookup(&remote, repo, git_buf_cstr(&remote_name))) < 0)
440 0 0 if (!refspec) {
445 0 0 if (git_refspec_transform(&buf, refspec, git_buf_cstr(&merge_name)) < 0)
448 0 0 if (git_buf_set(&buf, git_buf_cstr(&merge_name), git_buf_len(&merge_name)) < 0)
467 0 0 if (!git_reference__is_branch(refname))
470 0 0 if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
475 0 0 if ((error = retrieve_upstream_configuration(buf, cfg, refname, "branch.%s.remote")) < 0)
478 0 0 if (git_buf_len(buf) == 0) {
496 0 0 assert(buf && repo && refname);
0 0 assert(buf && repo && refname);
0 0 assert(buf && repo && refname);
501 0 0 if (!git_reference__is_remote(refname)) {
509 0 0 if ((error = git_remote_list(&remote_list, repo)) < 0)
513 0 0 for (i = 0; i < remote_list.count; i++) {
514 0 0 if ((error = git_remote_lookup(&remote, repo, remote_list.strings[i])) < 0)
518 0 0 if (fetchspec) {
523 0 0 if (!remote_name) {
538 0 0 if (remote_name) {
548 0 0 if (error < 0)
562 2 0 if ((error = git_branch_upstream_name(&tracking_name,
579 0 0 if (git_buf_printf(&buf, "branch.%s.remote", shortname) < 0)
582 0 0 if (git_config_delete_entry(config, git_buf_cstr(&buf)) < 0)
586 0 0 if (git_buf_printf(&buf, "branch.%s.merge", shortname) < 0)
589 0 0 if (git_config_delete_entry(config, git_buf_cstr(&buf)) < 0)
612 0 0 if (!git_reference__is_branch(refname))
615 0 0 if (git_repository_config__weakptr(&config, git_reference_owner(branch)) < 0)
621 0 0 if (branch_name == NULL)
627 0 0 if (git_branch_lookup(&upstream, repo, branch_name, GIT_BRANCH_LOCAL) == 0)
629 0 0 else if (git_branch_lookup(&upstream, repo, branch_name, GIT_BRANCH_REMOTE) == 0)
643 0 0 if (local)
648 0 0 if (error < 0)
652 0 0 if (git_buf_printf(&key, "branch.%s.remote", shortname) < 0)
655 0 0 if (git_config_set_string(config, git_buf_cstr(&key), git_buf_cstr(&remote_name)) < 0)
658 0 0 if (local) {
660 0 0 if (git_buf_puts(&merge_refspec, git_reference_name(upstream)) < 0)
664 0 0 if (git_remote_lookup(&remote, repo, git_buf_cstr(&remote_name)) < 0)
668 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)
677 0 0 if (git_buf_printf(&key, "branch.%s.merge", shortname) < 0)
680 0 0 if (git_config_set_string(config, git_buf_cstr(&key), git_buf_cstr(&merge_refspec)) < 0)
707 0 2 assert(branch);
709 0 2 if (!git_reference_is_branch(branch))
714 2 0 if (error == GIT_EUNBORNBRANCH || error == GIT_ENOTFOUND)
0 2 if (error == GIT_EUNBORNBRANCH || error == GIT_ENOTFOUND)
717 0 2 if (error < 0)