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 4147 return isalnum(c) || c == '-';
0 0 return isalnum(c) || c == '-';
40 46655 1892 for (ptr = line; *ptr; ++ptr) {
41 0 46655 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 46655 0 if ((ptr[0] == ';' || ptr[0] == '#') &&
0 46655 if ((ptr[0] == ';' || ptr[0] == '#') &&
0 0 if ((ptr[0] == ';' || ptr[0] == '#') &&
45 0 0 (quote_count % 2) == 0 &&
51 0 46655 if (ptr[0] == '\\')
58 3784 0 while (ptr > line && git__isspace(ptr[-1])) {
1892 1892 while (ptr > line && git__isspace(ptr[-1])) {
76 0 273 while (git__isspace(line[pos]))
80 0 273 if (line[pos] != '"') {
89 0 273 if ((last_quote - line) > INT_MAX) {
94 0 273 if (quoted_len == 0) {
99 0 273 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
0 273 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, base_name_len, quoted_len);
100 0 273 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
0 273 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
128 0 0 if (c == 0) {
139 2098 273 } while (line + rpos < last_quote);
142 0 273 if (git_buf_oom(&buf))
145 273 0 if (line[rpos] != '"' || line[rpos + 1] != ']') {
0 273 if (line[rpos] != '"' || line[rpos + 1] != ']') {
170 0 872 if (line == NULL)
175 0 872 if (name_end == NULL) {
181 0 872 GIT_ERROR_CHECK_ALLOC_ADD(&line_len, (size_t)(name_end - line), 1);
0 872 GIT_ERROR_CHECK_ALLOC_ADD(&line_len, (size_t)(name_end - line), 1);
183 0 872 GIT_ERROR_CHECK_ALLOC(name);
190 0 872 assert(c == '[');
195 273 4147 if (git__isspace(c)){
203 0 4147 if (!config_keychar(c) && c != '.') {
0 0 if (!config_keychar(c) && c != '.') {
210 3548 599 } while ((c = line[pos++]) != ']');
212 0 599 if (line[pos - 1] != ']') {
236 0 180 if (bom == GIT_BOM_UTF8)
292 0 1892 if (GIT_ADD_SIZET_OVERFLOW(&alloc_len, ptr_len, 1) ||
0 1892 if (GIT_ADD_SIZET_OVERFLOW(&alloc_len, ptr_len, 1) ||
299 25259 1892 while (*ptr != '\0') {
300 0 25259 if (*ptr == '"') {
302 25259 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 1892 13828 return isalnum(c) || c == '-';
0 1892 return isalnum(c) || c == '-';
394 15720 0 while (*name_end && is_namechar(*name_end))
13828 1892 while (*name_end && is_namechar(*name_end))
397 0 1892 if (line == name_end) {
404 3784 0 while (*value_start && git__isspace(*value_start))
1892 1892 while (*value_start && git__isspace(*value_start))
407 1892 0 if (*value_start == '=') {
409 0 0 } else if (*value_start) {
414 0 1892 if ((*name = git__strndup(line, name_end - line)) == NULL)
432 0 1892 GIT_ERROR_CHECK_ALLOC(line);
436 0 1892 if ((error = parse_name(&name, &value_start, reader, line)) < 0)
442 1892 0 if (value_start != NULL) {
443 1892 1892 while (git__isspace(value_start[0]))
446 0 1892 if ((error = unescape_line(&value, &multiline, value_start, 0)) < 0)
449 0 1892 if (multiline) {
504 2764 180 for (; ctx->remain_len > 0; git_parse_advance_line(ctx)) {
528 0 872 if (result < 0)
533 178 694 if (on_section)
542 0 872 if (!git_parse_peek(&c, ctx, GIT_PARSE_PEEK_SKIP_WHITESPACE))
553 0 0 if (on_comment) {
559 1892 0 if ((result = parse_variable(parser, &var_name, &var_value)) == 0 && on_variable) {
1892 0 if ((result = parse_variable(parser, &var_name, &var_value)) == 0 && on_variable) {
568 0 2764 if (result < 0)
572 49 131 if (on_eof)