Branch Coverage

deps/libgit2/src/libgit2/hashsig.c
Criterion Covered Total %
branch 70 122 57.3


line true false branch
59 48 6 return (av < bv) ? -1 : (av > bv) ? 1 : 0;
66 68 0 return (av > bv) ? -1 : (av < bv) ? 1 : 0;
73 50 24 while (el > 0 && h->cmp(&h->values[parent_el], &h->values[el], NULL) > 0) {
2 48 while (el > 0 && h->cmp(&h->values[parent_el], &h->values[el], NULL) > 0) {
89 0 0 while (el < h->size / 2) {
96 0 0 if (h->cmp(&v, &lv, NULL) < 0 && h->cmp(&v, &rv, NULL) < 0)
0 0 if (h->cmp(&v, &lv, NULL) < 0 && h->cmp(&v, &rv, NULL) < 0)
99 0 0 swapel = (h->cmp(&lv, &rv, NULL) < 0) ? lel : rel;
117 72 0 if (h->size < h->asize) {
123 0 0 else if (h->cmp(&val, &h->values[0], NULL) > 0) {
142 2 9 GIT_ASSERT(!(sig->opt & GIT_HASHSIG_IGNORE_WHITESPACE) ||
0 2 GIT_ASSERT(!(sig->opt & GIT_HASHSIG_IGNORE_WHITESPACE) ||
145 2 9 if (sig->opt & GIT_HASHSIG_IGNORE_WHITESPACE) {
146 512 2 for (i = 0; i < 256; ++i)
149 9 0 } else if (sig->opt & GIT_HASHSIG_SMART_WHITESPACE) {
150 2304 9 for (i = 0; i < 256; ++i)
171 39 11 while (scan < end) {
174 575 4 for (len = 0; scan < end && len < HASHSIG_MAX_RUN; ) {
575 0 for (len = 0; scan < end && len < HASHSIG_MAX_RUN; ) {
177 139 436 if (use_ignores)
178 141 0 for (; scan < end && git__isspace_nonlf(ch); ch = *scan)
2 139 for (; scan < end && git__isspace_nonlf(ch); ch = *scan)
180 436 0 else if (sig->opt &
182 436 0 for (; scan < end && ch == '\r'; ch = *scan)
0 436 for (; scan < end && ch == '\r'; ch = *scan)
186 465 110 if (sig->opt & GIT_HASHSIG_SMART_WHITESPACE)
189 0 575 if (scan >= end)
194 540 35 if (ch == '\n' || ch == '\0') {
0 540 if (ch == '\n' || ch == '\0') {
203 36 3 if (len > 0) {
207 25 11 while (scan < end && (*scan == '\n' || !*scan))
0 25 while (scan < end && (*scan == '\n' || !*scan))
0 25 while (scan < end && (*scan == '\n' || !*scan))
219 4 7 if (sig->mins.size < HASHSIG_HEAP_MIN_SIZE &&
0 4 if (sig->mins.size < HASHSIG_HEAP_MIN_SIZE &&
235 0 11 if (!sig)
254 0 6 GIT_ERROR_CHECK_ALLOC(sig);
256 0 6 if ((error = hashsig_in_progress_init(&prog, sig)) < 0)
261 6 0 if (!error)
264 6 0 if (!error)
282 0 5 GIT_ERROR_CHECK_ALLOC(sig);
284 0 5 if ((fd = git_futils_open_ro(path)) < 0) {
289 0 5 if ((error = hashsig_in_progress_init(&prog, sig)) < 0) {
294 10 0 while (!error) {
295 5 5 if ((buflen = p_read(fd, buf, sizeof(buf))) <= 0) {
296 0 5 if ((error = (int)buflen) < 0)
307 5 0 if (!error)
310 5 0 if (!error)
327 0 7 GIT_ASSERT_WITH_RETVAL(a->cmp == b->cmp, 0);
331 24 1 for (i = 0, j = 0; i < a->size && j < b->size; ) {
18 6 for (i = 0, j = 0; i < a->size && j < b->size; ) {
334 0 18 if (cmp < 0)
336 6 12 else if (cmp > 0)
352 0 7 if (a->mins.size == 0 && b->mins.size == 0) {
0 0 if (a->mins.size == 0 && b->mins.size == 0) {
353 0 0 if ((!a->lines && !b->lines) ||
0 0 if ((!a->lines && !b->lines) ||
0 0 if ((!a->lines && !b->lines) ||
363 7 0 if (a->mins.size < HASHSIG_HEAP_SIZE) {
368 0 0 if ((mins = hashsig_heap_compare(&a->mins, &b->mins)) < 0)
370 0 0 if ((maxs = hashsig_heap_compare(&a->maxs, &b->maxs)) < 0)