Branch Coverage

deps/libgit2/src/libgit2/diff_driver.c
Criterion Covered Total %
branch 15 178 8.4


line true false branch
62 0 0 if (!reg)
65 0 0 if (git_strmap_new(®->drivers) < 0) {
77 63 0 if (!reg)
80 0 0 git_strmap_foreach_value(reg->drivers, drv, git_diff_driver_free(drv));
93 0 0 for (scan = regex_str; scan; scan = end) {
95 0 0 if ((pat = git_array_alloc(drv->fn_patterns)) == NULL) {
0 0 if ((pat = git_array_alloc(drv->fn_patterns)) == NULL) {
0 0 if ((pat = git_array_alloc(drv->fn_patterns)) == NULL) {
100 0 0 if (*scan == '!') {
105 0 0 if ((end = strchr(scan, '\n')) != NULL) {
111 0 0 if (error < 0)
121 0 0 if (error && pat != NULL)
0 0 if (error && pat != NULL)
122 0 0 (void)git_array_pop(drv->fn_patterns); /* release last item */
143 0 0 if (reg)
147 0 0 if (!newreg) {
152 0 0 if (!reg) {
169 0 0 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, driverlen, namelen);
0 0 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, driverlen, namelen);
170 0 0 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
0 0 GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
173 0 0 GIT_ERROR_CHECK_ALLOC(driver);
179 0 0 if (namelen_out)
195 0 0 for (idx = 0; idx < ARRAY_SIZE(builtin_defs); ++idx) {
196 0 0 if (!strcasecmp(driver_name, builtin_defs[idx].name)) {
201 0 0 if (!ddef)
204 0 0 if ((error = diff_driver_alloc(&drv, NULL, ddef->name)) < 0)
209 0 0 if (ddef->fns &&
0 0 if (ddef->fns &&
214 0 0 if (ddef->words &&
0 0 if (ddef->words &&
218 0 0 if ((error = git_strmap_set(reg->drivers, drv->name, drv)) < 0)
222 0 0 if (error && drv)
0 0 if (error && drv)
242 0 0 if ((reg = git_repository_driver_registry(repo)) == NULL)
245 0 0 if ((drv = git_strmap_get(reg->drivers, driver_name)) != NULL) {
250 0 0 if ((error = diff_driver_alloc(&drv, &namelen, driver_name)) < 0)
256 0 0 if (git_repository_config_snapshot(&cfg, repo) < 0) {
261 0 0 if ((error = git_str_printf(&name, "diff.%s.binary", driver_name)) < 0)
283 0 0 if ((error = git_str_PUTS(&name, "xfuncname")) < 0)
286 0 0 if ((error = git_config_get_multivar_foreach(
288 0 0 if (error != GIT_ENOTFOUND)
294 0 0 if ((error = git_str_PUTS(&name, "funcname")) < 0)
297 0 0 if ((error = git_config_get_multivar_foreach(
299 0 0 if (error != GIT_ENOTFOUND)
305 0 0 if (git_array_size(drv->fn_patterns) > 0) {
311 0 0 if ((error = git_str_PUTS(&name, "wordregex")) < 0)
314 0 0 if ((error = git_config__lookup_entry(&ce, cfg, name.ptr, false)) < 0)
316 0 0 if (!ce || !ce->value)
0 0 if (!ce || !ce->value)
318 0 0 else if (!(error = git_regexp_compile(&drv->word_pattern, ce->value, 0)))
330 0 0 if (!found_driver)
334 0 0 if ((error = git_strmap_set(reg->drivers, drv->name, drv)) < 0)
344 0 0 if (!*out) {
346 0 0 if (!error)
350 0 0 if (drv && drv != *out)
0 0 if (drv && drv != *out)
363 0 100 GIT_ASSERT_ARG(out);
366 100 0 if (!repo || !path || !strlen(path))
100 0 if (!repo || !path || !strlen(path))
100 0 if (!repo || !path || !strlen(path))
368 100 0 else if ((error = git_attr_get_many_with_session(values, repo,
372 0 100 else if (GIT_ATTR_IS_UNSPECIFIED(values[0]))
374 0 0 else if (GIT_ATTR_IS_FALSE(values[0]))
376 0 0 else if (GIT_ATTR_IS_TRUE(values[0]))
380 0 0 else if ((error = git_diff_driver_load(out, repo, values[0])) < 0) {
381 0 0 if (error == GIT_ENOTFOUND) {
387 100 0 if (!*out)
397 0 0 if (!driver)
400 0 0 while ((pat = git_array_pop(driver->fn_patterns)) != NULL)
0 0 while ((pat = git_array_pop(driver->fn_patterns)) != NULL)
412 96 4 if ((*option_flags & FORCE_DIFFABLE) == 0)
434 0 60 if (git_str_contains_nul(&search))
445 0 0 return (git__isalpha(firstch) || firstch == '_' || firstch == '$');
0 0 return (git__isalpha(firstch) || firstch == '_' || firstch == '$');
0 0 return (git__isalpha(firstch) || firstch == '_' || firstch == '$');
454 0 0 for (i = 0; i < maxi; ++i) {
455 0 0 git_diff_driver_pattern *pat = git_array_get(driver->fn_patterns, i);
457 0 0 if (!git_regexp_search(&pat->re, line->ptr, 2, pmatch)) {
458 0 0 if (pat->flags & REG_NEGATE)
483 0 0 if (git_str_set(&ctxt->line, line, (size_t)line_len) < 0)
487 0 0 if (!ctxt->line.size)
490 0 0 if (!ctxt->match_line || !ctxt->match_line(ctxt->driver, &ctxt->line))
0 0 if (!ctxt->match_line || !ctxt->match_line(ctxt->driver, &ctxt->line))
493 0 0 if (out_size > (long)ctxt->line.size)
505 38 0 *findfn_out = driver ? diff_context_find : NULL;
508 38 0 if (driver) {
511 0 38 diff_context_line__pattern_match : diff_context_line__simple;
518 38 0 if (payload) {