Branch Coverage

deps/libgit2/src/config_parse.c
Criterion Covered Total %
branch 72 154 46.7


line true false branch
19 0 0 if (col)
32 0 3484 return isalnum(c) || c == '-';
0 0 return isalnum(c) || c == '-';
40 39412 1617 for (ptr = line; *ptr; ++ptr) {
41 0 39412 if (ptr[0] == '"' && ptr > line && ptr[-1] != '\\')
0 0 if (ptr[0] == '"' && ptr > line && ptr[-1] != '\\')
0 0 if (ptr[0] == '"' && ptr > line && ptr[-1] != '\\')
44 39412 0 if ((ptr[0] == ';' || ptr[0] == '#') &&
0 39412 if ((ptr[0] == ';' || ptr[0] == '#') &&
0 0 if ((ptr[0] == ';' || ptr[0] == '#') &&
45 0 0 (quote_count % 2) == 0 &&
51 0 39412 if (ptr[0] == '\\')
58 3234 0 while (ptr > line && git__isspace(ptr[-1])) {
1617 1617 while (ptr > line && git__isspace(ptr[-1])) {
76 0 221 while (git__isspace(line[pos]))
80 0 221 if (line[pos] != '"') {
89 0 221 if ((last_quote - line) > INT_MAX) {
94 0 221 if (quoted_len == 0) {
99 0 221 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
0 221 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
100 0 221 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
0 221 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
128 0 0 if (c == 0) {
139 1695 221 } while (line + rpos < last_quote);
142 0 221 if (git_buf_oom(&buf))
145 221 0 if (line[rpos] != '"' || line[rpos + 1] != ']') {
0 221 if (line[rpos] != '"' || line[rpos + 1] != ']') {
170 0 737 if (line == NULL)
175 0 737 if (name_end == NULL) {
181 0 737 GIT_ERROR_CHECK_ALLOC_ADD(&line_len, (size_t)(name_end - line), 1);
0 737 GIT_ERROR_CHECK_ALLOC_ADD(&line_len, (size_t)(name_end - line), 1);
183 0 737 GIT_ERROR_CHECK_ALLOC(name);
190 0 737 assert(c == '[');
195 221 3484 if (git__isspace(c)){
203 0 3484 if (!config_keychar(c) && c != '.') {
0 0 if (!config_keychar(c) && c != '.') {
210 2968 516 } while ((c = line[pos++]) != ']');
212 0 516 if (line[pos - 1] != ']') {
236 0 161 if (bom == GIT_BOM_UTF8)
292 0 1617 if (GIT_ADD_SIZET_OVERFLOW(&alloc_len, ptr_len, 1) ||
0 1617 if (GIT_ADD_SIZET_OVERFLOW(&alloc_len, ptr_len, 1) ||
299 21119 1617 while (*ptr != '\0') {
300 0 21119 if (*ptr == '"') {
302 21119 0 } else if (*ptr != '\\') {
308 0 0 if (*ptr == '\0') {
312 0 0 if ((esc = strchr(git_config_escapes, *ptr)) != NULL) {
335 0 0 while (multiline) {
342 0 0 GIT_ERROR_CHECK_ALLOC(line);
348 0 0 if (line[0] == '\0') {
355 0 0 if (line[0] == '\0')
358 0 0 if ((error = unescape_line(&proc_line, &multiline,
363 0 0 if ((error = git_buf_puts(value, proc_line)) < 0)
383 1617 11825 return isalnum(c) || c == '-';
0 1617 return isalnum(c) || c == '-';
394 13442 0 while (*name_end && is_namechar(*name_end))
11825 1617 while (*name_end && is_namechar(*name_end))
397 0 1617 if (line == name_end) {
404 3234 0 while (*value_start && git__isspace(*value_start))
1617 1617 while (*value_start && git__isspace(*value_start))
407 1617 0 if (*value_start == '=') {
409 0 0 } else if (*value_start) {
414 0 1617 if ((*name = git__strndup(line, name_end - line)) == NULL)
432 0 1617 GIT_ERROR_CHECK_ALLOC(line);
436 0 1617 if ((error = parse_name(&name, &value_start, reader, line)) < 0)
442 1617 0 if (value_start != NULL) {
443 1617 1617 while (git__isspace(value_start[0]))
446 0 1617 if ((error = unescape_line(&value, &multiline, value_start, 0)) < 0)
449 0 1617 if (multiline) {
504 2354 161 for (; ctx->remain_len > 0; git_parse_advance_line(ctx)) {
528 0 737 if (result < 0)
533 178 559 if (on_section)
542 0 737 if (!git_parse_peek(&c, ctx, GIT_PARSE_PEEK_SKIP_WHITESPACE))
553 0 0 if (on_comment) {
559 1617 0 if ((result = parse_variable(parser, &var_name, &var_value)) == 0 && on_variable) {
1617 0 if ((result = parse_variable(parser, &var_name, &var_value)) == 0 && on_variable) {
568 0 2354 if (result < 0)
572 49 112 if (on_eof)