Branch Coverage

deps/libgit2/src/libgit2/branch.c
Criterion Covered Total %
branch 53 244 21.7


line true false branch
33 1 14 prefix = is_remote ? GIT_REFS_REMOTES_DIR : GIT_REFS_HEADS_DIR;
35 15 0 if ((error = git_str_joinpath(&ref_name, prefix, branch_name)) < 0)
37 2 13 else if ((error = git_reference_lookup(&branch, repo, ref_name.ptr)) < 0)
38 1 1 git_error_set(
64 16 0 return branch_name[0] != '-' && git__strcmp(branch_name, "HEAD");
16 0 return branch_name[0] != '-' && git__strcmp(branch_name, "HEAD");
82 0 16 GIT_ASSERT_ARG(branch_name);
83 0 16 GIT_ASSERT_ARG(commit);
84 0 16 GIT_ASSERT_ARG(ref_out);
85 0 16 GIT_ASSERT_ARG(git_commit_owner(commit) == repository);
87 0 16 if (!branch_name_is_valid(branch_name)) {
93 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) {
98 0 0 if (error < 0)
104 0 16 if (is_unmovable_head && force) {
0 0 if (is_unmovable_head && force) {
111 0 16 if (git_str_joinpath(&canonical_branch_name, GIT_REFS_HEADS_DIR, branch_name) < 0)
114 0 16 if (git_str_printf(&log_message, "branch: Created from %s", from) < 0)
121 16 0 if (!error)
160 0 17 if (git_repository_is_bare(worktree))
163 0 17 if ((error = git_reference_lookup(&head, worktree, GIT_HEAD_FILE)) < 0) {
164 0 0 if (error == GIT_ENOTFOUND)
169 0 17 if (git_reference_type(head) != GIT_REFERENCE_SYMBOLIC)
181 0 17 GIT_ASSERT_ARG(branch);
183 0 17 if (!git_reference_is_branch(branch))
195 0 0 GIT_ASSERT_ARG(branch);
197 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)) {
203 0 0 if ((is_head = git_branch_is_head(branch)) < 0)
206 0 0 if (is_head) {
212 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)) {
218 0 0 if (git_str_join(&config_section, '.', "branch",
222 0 0 if (git_config_rename_section(
244 6 2 while ((error = git_reference_next(&ref, iter->iter)) == 0) {
273 0 2 GIT_ERROR_CHECK_ALLOC(iter);
277 0 2 if (git_reference_iterator_new(&iter->iter, repo) < 0) {
291 0 2 if (iter == NULL)
310 0 1 GIT_ASSERT_ARG(branch);
311 0 1 GIT_ASSERT_ARG(new_branch_name);
313 0 1 if (!git_reference_is_branch(branch))
316 0 1 if ((error = git_str_joinpath(&new_reference_name, GIT_REFS_HEADS_DIR, new_branch_name)) < 0)
319 0 1 if ((error = git_str_printf(&log_message, "branch: renamed %s to %s",
328 0 1 if (error < 0)
357 0 15 GIT_ASSERT_ARG(ref_out);
358 0 15 GIT_ASSERT_ARG(repo);
359 0 15 GIT_ASSERT_ARG(branch_name);
368 0 0 if (error == GIT_ENOTFOUND)
383 0 0 GIT_ASSERT_ARG(out);
384 0 0 GIT_ASSERT_ARG(ref);
388 0 0 if (git_reference_is_branch(ref)) {
390 0 0 } else if (git_reference_is_remote(ref)) {
410 0 4 if (git_str_printf(&buf, format,
424 2 0 GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_name, repo, refname);
0 2 GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_name, repo, refname);
440 0 4 GIT_ASSERT_ARG(out);
441 0 4 GIT_ASSERT_ARG(repo);
442 0 4 GIT_ASSERT_ARG(refname);
444 0 4 if (!git_reference__is_branch(refname))
447 0 4 if ((error = git_repository_config_snapshot(&config, repo)) < 0)
450 4 0 if ((error = retrieve_upstream_configuration(
454 0 0 if ((error = retrieve_upstream_configuration(
458 0 0 if (git_str_len(&remote_name) == 0 || git_str_len(&merge_name) == 0) {
0 0 if (git_str_len(&remote_name) == 0 || git_str_len(&merge_name) == 0) {
465 0 0 if (strcmp(".", git_str_cstr(&remote_name)) != 0) {
466 0 0 if ((error = git_remote_lookup(&remote, repo, git_str_cstr(&remote_name))) < 0)
470 0 0 if (!refspec) {
475 0 0 if (git_refspec__transform(&buf, refspec, git_str_cstr(&merge_name)) < 0)
478 0 0 if (git_str_set(&buf, git_str_cstr(&merge_name), git_str_len(&merge_name)) < 0)
502 0 0 if (!git_reference__is_branch(refname))
505 0 0 if ((error = git_repository_config__weakptr(&cfg, repo)) < 0 ||
0 0 if ((error = git_repository_config__weakptr(&cfg, repo)) < 0 ||
509 0 0 if (git_str_len(out) == 0) {
522 0 0 GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_remote, repo, refname);
0 0 GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_remote, repo, refname);
538 0 0 GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_merge, repo, refname);
0 0 GIT_BUF_WRAP_PRIVATE(out, git_branch__upstream_merge, repo, refname);
554 0 0 GIT_BUF_WRAP_PRIVATE(out, git_branch__remote_name, repo, refname);
0 0 GIT_BUF_WRAP_PRIVATE(out, git_branch__remote_name, repo, refname);
569 0 0 GIT_ASSERT_ARG(out);
570 0 0 GIT_ASSERT_ARG(repo);
571 0 0 GIT_ASSERT_ARG(refname);
574 0 0 if (!git_reference__is_remote(refname)) {
582 0 0 if ((error = git_remote_list(&remote_list, repo)) < 0)
586 0 0 for (i = 0; i < remote_list.count; i++) {
587 0 0 if ((error = git_remote_lookup(&remote, repo, remote_list.strings[i])) < 0)
591 0 0 if (fetchspec) {
596 0 0 if (!remote_name) {
611 0 0 if (remote_name) {
621 0 0 if (error < 0)
635 2 0 if ((error = git_branch__upstream_name(&tracking_name,
652 0 0 if (git_str_printf(&buf, "branch.%s.remote", shortname) < 0)
655 0 0 if (git_config_delete_entry(config, git_str_cstr(&buf)) < 0)
659 0 0 if (git_str_printf(&buf, "branch.%s.merge", shortname) < 0)
662 0 0 if (git_config_delete_entry(config, git_str_cstr(&buf)) < 0)
685 0 0 if (!git_reference__is_branch(refname))
688 0 0 if (git_repository_config__weakptr(&config, git_reference_owner(branch)) < 0)
694 0 0 if (branch_name == NULL)
700 0 0 if (git_branch_lookup(&upstream, repo, branch_name, GIT_BRANCH_LOCAL) == 0)
702 0 0 else if (git_branch_lookup(&upstream, repo, branch_name, GIT_BRANCH_REMOTE) == 0)
716 0 0 if (local)
721 0 0 if (error < 0)
725 0 0 if (git_str_printf(&key, "branch.%s.remote", shortname) < 0)
728 0 0 if (git_config_set_string(config, git_str_cstr(&key), git_str_cstr(&remote_name)) < 0)
731 0 0 if (local) {
733 0 0 if (git_str_puts(&merge_refspec, git_reference_name(upstream)) < 0)
737 0 0 if (git_remote_lookup(&remote, repo, git_str_cstr(&remote_name)) < 0)
741 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)
750 0 0 if (git_str_printf(&key, "branch.%s.merge", shortname) < 0)
753 0 0 if (git_config_set_string(config, git_str_cstr(&key), git_str_cstr(&merge_refspec)) < 0)
780 0 1 GIT_ASSERT_ARG(branch);
782 0 1 if (!git_reference_is_branch(branch))
787 1 0 if (error == GIT_EUNBORNBRANCH || error == GIT_ENOTFOUND)
0 1 if (error == GIT_EUNBORNBRANCH || error == GIT_ENOTFOUND)
790 0 1 if (error < 0)
807 0 0 GIT_ASSERT(valid);
811 0 0 if (!name || !branch_name_is_valid(name))
0 0 if (!name || !branch_name_is_valid(name))
814 0 0 if ((error = git_str_puts(&ref_name, GIT_REFS_HEADS_DIR)) < 0 ||
0 0 if ((error = git_str_puts(&ref_name, GIT_REFS_HEADS_DIR)) < 0 ||