Branch Coverage

deps/libgit2/src/libgit2/refspec.c
Criterion Covered Total %
branch 83 198 41.9


line true false branch
26 0 45 GIT_ASSERT_ARG(refspec);
27 0 45 GIT_ASSERT_ARG(input);
33 13 32 if (*lhs == '+') {
44 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') {
47 0 0 GIT_ERROR_CHECK_ALLOC(refspec->string);
49 0 0 GIT_ERROR_CHECK_ALLOC(refspec->src);
51 0 0 GIT_ERROR_CHECK_ALLOC(refspec->dst);
55 45 0 if (rhs) {
57 0 45 if (rlen || !is_fetch) {
0 0 if (rlen || !is_fetch) {
58 45 0 is_glob = (1 <= rlen && strchr(rhs, '*'));
13 32 is_glob = (1 <= rlen && strchr(rhs, '*'));
63 45 0 llen = (rhs ? (size_t)(rhs - lhs - 1) : strlen(lhs));
64 45 0 if (1 <= llen && memchr(lhs, '*', llen)) {
13 32 if (1 <= llen && memchr(lhs, '*', llen)) {
65 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))
68 32 0 } else if (rhs && is_glob)
0 32 } else if (rhs && is_glob)
73 13 32 flags = GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL |
77 43 2 if (is_fetch) {
83 43 0 if (!*refspec->src)
85 0 43 else if (git_reference__name_is_valid(&valid, refspec->src, flags) < 0)
87 0 43 else if (!valid)
96 43 0 if (!refspec->dst)
98 43 0 else if (!*refspec->dst)
100 0 43 else if (git_reference__name_is_valid(&valid, refspec->dst, flags) < 0)
102 0 43 else if (!valid)
112 2 0 if (!*refspec->src)
114 0 2 else if (is_glob) {
115 0 0 if (git_reference__name_is_valid(&valid, refspec->src, flags) < 0)
117 0 0 else if (!valid)
131 0 2 if (!refspec->dst) {
132 0 0 if (git_reference__name_is_valid(&valid, refspec->src, flags) < 0)
134 0 0 else if (!valid)
136 0 2 } else if (!*refspec->dst) {
139 0 2 if (git_reference__name_is_valid(&valid, refspec->dst, flags) < 0)
141 0 2 else if (!valid)
146 0 2 if (!refspec->dst) {
148 0 0 GIT_ERROR_CHECK_ALLOC(refspec->dst);
153 0 45 GIT_ERROR_CHECK_ALLOC(refspec->string);
170 0 44 if (refspec == NULL)
183 0 1 GIT_ASSERT_ARG(out_refspec);
184 0 1 GIT_ASSERT_ARG(input);
189 0 1 GIT_ERROR_CHECK_ALLOC(refspec);
191 0 1 if (git_refspec__parse(refspec, input, !!is_fetch) != 0) {
208 3 0 return refspec == NULL ? NULL : refspec->src;
213 3 0 return refspec == NULL ? NULL : refspec->dst;
218 5 0 return refspec == NULL ? NULL : refspec->string;
223 0 2 GIT_ASSERT_ARG(refspec);
230 2 0 if (refspec == NULL || refspec->src == NULL)
0 2 if (refspec == NULL || refspec->src == NULL)
238 5 0 if (refspec == NULL || refspec->dst == NULL)
0 5 if (refspec == NULL || refspec->dst == NULL)
261 2 0 GIT_ASSERT(from_star && to_star);
0 2 GIT_ASSERT(from_star && to_star);
281 1 0 GIT_BUF_WRAP_PRIVATE(out, git_refspec__transform, spec, name);
1 0 GIT_BUF_WRAP_PRIVATE(out, git_refspec__transform, spec, name);
286 0 1 GIT_ASSERT_ARG(out);
287 0 1 GIT_ASSERT_ARG(spec);
288 0 1 GIT_ASSERT_ARG(name);
290 0 1 if (!git_refspec_src_matches(spec, name)) {
295 0 1 if (!spec->pattern)
296 0 0 return git_str_puts(out, spec->dst ? spec->dst : "");
303 1 0 GIT_BUF_WRAP_PRIVATE(out, git_refspec__rtransform, spec, name);
1 0 GIT_BUF_WRAP_PRIVATE(out, git_refspec__rtransform, spec, name);
308 0 1 GIT_ASSERT_ARG(out);
309 0 1 GIT_ASSERT_ARG(spec);
310 0 1 GIT_ASSERT_ARG(name);
312 0 1 if (!git_refspec_dst_matches(spec, name)) {
317 0 1 if (!spec->pattern)
325 0 0 if (refspec->force)
328 0 0 git_str_printf(out, "%s:%s",
0 0 git_str_printf(out, "%s:%s",
337 0 0 GIT_ASSERT_ARG(spec);
338 0 0 GIT_ASSERT_ARG(spec->src);
345 0 3 GIT_ASSERT_ARG(spec);
364 0 13 GIT_ASSERT_ARG(out);
365 0 13 GIT_ASSERT_ARG(spec);
366 0 13 GIT_ASSERT_ARG(refs);
369 0 13 GIT_ERROR_CHECK_ALLOC(cur);
378 0 13 if (git__prefixcmp(spec->src, GIT_REFS_DIR)) {
379 0 0 for (j = 0; formatters[j]; j++) {
382 0 0 GIT_ERROR_CHECK_ALLOC_STR(&buf);
385 0 0 if (!git_vector_search(&pos, refs, &key)) {
393 13 0 if (cur->src == NULL && spec->src != NULL) {
13 0 if (cur->src == NULL && spec->src != NULL) {
395 0 13 GIT_ERROR_CHECK_ALLOC(cur->src);
398 13 0 if (spec->dst && git__prefixcmp(spec->dst, GIT_REFS_DIR)) {
0 13 if (spec->dst && git__prefixcmp(spec->dst, GIT_REFS_DIR)) {
400 0 0 if (!git__prefixcmp(spec->dst, "remotes/")) {
407 0 0 GIT_ERROR_CHECK_ALLOC_STR(&buf);
414 13 0 if (cur->dst == NULL && spec->dst != NULL) {
13 0 if (cur->dst == NULL && spec->dst != NULL) {
416 0 13 GIT_ERROR_CHECK_ALLOC(cur->dst);