Branch Coverage

deps/libgit2/src/refspec.c
Criterion Covered Total %
branch 76 180 42.2


line true false branch
26 45 0 assert(refspec && input);
0 45 assert(refspec && input);
32 13 32 if (*lhs == '+') {
43 2 43 if (!is_fetch && rhs == lhs && rhs[1] == '\0') {
0 2 if (!is_fetch && rhs == lhs && rhs[1] == '\0') {
0 0 if (!is_fetch && rhs == lhs && rhs[1] == '\0') {
46 0 0 GIT_ERROR_CHECK_ALLOC(refspec->string);
48 0 0 GIT_ERROR_CHECK_ALLOC(refspec->src);
50 0 0 GIT_ERROR_CHECK_ALLOC(refspec->dst);
54 45 0 if (rhs) {
56 0 45 if (rlen || !is_fetch) {
0 0 if (rlen || !is_fetch) {
57 45 0 is_glob = (1 <= rlen && strchr(rhs, '*'));
13 32 is_glob = (1 <= rlen && strchr(rhs, '*'));
62 45 0 llen = (rhs ? (size_t)(rhs - lhs - 1) : strlen(lhs));
63 45 0 if (1 <= llen && memchr(lhs, '*', llen)) {
13 32 if (1 <= llen && memchr(lhs, '*', llen)) {
64 13 0 if ((rhs && !is_glob) || (!rhs && is_fetch))
13 0 if ((rhs && !is_glob) || (!rhs && is_fetch))
0 13 if ((rhs && !is_glob) || (!rhs && is_fetch))
0 0 if ((rhs && !is_glob) || (!rhs && is_fetch))
67 32 0 } else if (rhs && is_glob)
0 32 } else if (rhs && is_glob)
73 13 32 GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND |
76 43 2 if (is_fetch) {
82 43 0 if (!*refspec->src)
84 0 43 else if (!git_reference__is_valid_name(refspec->src, flags))
92 43 0 if (!refspec->dst)
94 43 0 else if (!*refspec->dst)
96 0 43 else if (!git_reference__is_valid_name(refspec->dst, flags))
106 2 0 if (!*refspec->src)
108 0 2 else if (is_glob) {
109 0 0 if (!git_reference__is_valid_name(refspec->src, flags))
122 0 2 if (!refspec->dst) {
123 0 0 if (!git_reference__is_valid_name(refspec->src, flags))
125 0 2 } else if (!*refspec->dst) {
128 0 2 if (!git_reference__is_valid_name(refspec->dst, flags))
133 0 2 if (!refspec->dst) {
135 0 0 GIT_ERROR_CHECK_ALLOC(refspec->dst);
140 0 45 GIT_ERROR_CHECK_ALLOC(refspec->string);
154 0 44 if (refspec == NULL)
167 1 0 assert(out_refspec && input);
0 1 assert(out_refspec && input);
172 0 1 GIT_ERROR_CHECK_ALLOC(refspec);
174 0 1 if (git_refspec__parse(refspec, input, !!is_fetch) != 0) {
191 3 0 return refspec == NULL ? NULL : refspec->src;
196 3 0 return refspec == NULL ? NULL : refspec->dst;
201 5 0 return refspec == NULL ? NULL : refspec->string;
206 0 2 assert(refspec);
213 2 0 if (refspec == NULL || refspec->src == NULL)
0 2 if (refspec == NULL || refspec->src == NULL)
221 5 0 if (refspec == NULL || refspec->dst == NULL)
0 5 if (refspec == NULL || refspec->dst == NULL)
245 2 0 assert(from_star && to_star);
0 2 assert(from_star && to_star);
265 1 0 assert(out && spec && name);
1 0 assert(out && spec && name);
0 1 assert(out && spec && name);
268 0 1 if (!git_refspec_src_matches(spec, name)) {
273 0 1 if (!spec->pattern)
274 0 0 return git_buf_puts(out, spec->dst ? spec->dst : "");
281 1 0 assert(out && spec && name);
1 0 assert(out && spec && name);
0 1 assert(out && spec && name);
284 0 1 if (!git_refspec_dst_matches(spec, name)) {
289 0 1 if (!spec->pattern)
297 0 0 if (refspec->force)
300 0 0 git_buf_printf(out, "%s:%s",
0 0 git_buf_printf(out, "%s:%s",
309 0 0 assert(spec && spec->src);
0 0 assert(spec && spec->src);
316 0 3 assert(spec);
335 13 0 assert(out && spec && refs);
13 0 assert(out && spec && refs);
0 13 assert(out && spec && refs);
338 0 13 GIT_ERROR_CHECK_ALLOC(cur);
347 0 13 if (git__prefixcmp(spec->src, GIT_REFS_DIR)) {
348 0 0 for (j = 0; formatters[j]; j++) {
351 0 0 GIT_ERROR_CHECK_ALLOC_BUF(&buf);
354 0 0 if (!git_vector_search(&pos, refs, &key)) {
362 13 0 if (cur->src == NULL && spec->src != NULL) {
13 0 if (cur->src == NULL && spec->src != NULL) {
364 0 13 GIT_ERROR_CHECK_ALLOC(cur->src);
367 13 0 if (spec->dst && git__prefixcmp(spec->dst, GIT_REFS_DIR)) {
0 13 if (spec->dst && git__prefixcmp(spec->dst, GIT_REFS_DIR)) {
369 0 0 if (!git__prefixcmp(spec->dst, "remotes/")) {
376 0 0 GIT_ERROR_CHECK_ALLOC_BUF(&buf);
383 13 0 if (cur->dst == NULL && spec->dst != NULL) {
13 0 if (cur->dst == NULL && spec->dst != NULL) {
385 0 13 GIT_ERROR_CHECK_ALLOC(cur->dst);