MCPcopy Index your code
hub / github.com/git/git / git_diff_basic_config

Function git_diff_basic_config

diff.c:478–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478int git_diff_basic_config(const char *var, const char *value,
479 const struct config_context *ctx, void *cb)
480{
481 const char *name;
482
483 if (!strcmp(var, "diff.renamelimit")) {
484 diff_rename_limit_default = git_config_int(var, value, ctx->kvi);
485 return 0;
486 }
487
488 if (userdiff_config(var, value) < 0)
489 return -1;
490
491 if (skip_prefix(var, "diff.color.", &name) ||
492 skip_prefix(var, "color.diff.", &name)) {
493 int slot = parse_diff_color_slot(name);
494 if (slot < 0)
495 return 0;
496 if (!value)
497 return config_error_nonbool(var);
498 return color_parse(value, diff_colors[slot]);
499 }
500
501 if (!strcmp(var, "diff.wserrorhighlight")) {
502 int val;
503 if (!value)
504 return config_error_nonbool(var);
505 val = parse_ws_error_highlight(value);
506 if (val < 0)
507 return error(_("unknown value for config '%s': %s"),
508 var, value);
509 ws_error_highlight_default = val;
510 return 0;
511 }
512
513 /* like GNU diff's --suppress-blank-empty option */
514 if (!strcmp(var, "diff.suppressblankempty") ||
515 /* for backwards compatibility */
516 !strcmp(var, "diff.suppress-blank-empty")) {
517 diff_suppress_blank_empty = git_config_bool(var, value);
518 return 0;
519 }
520
521 if (!strcmp(var, "diff.dirstat")) {
522 struct strbuf errmsg = STRBUF_INIT;
523 if (!value)
524 return config_error_nonbool(var);
525 default_diff_options.dirstat_permille = diff_dirstat_permille_default;
526 if (parse_dirstat_params(&default_diff_options, value, &errmsg))
527 warning(_("Found errors in 'diff.dirstat' config variable:\n%s"),
528 errmsg.buf);
529 strbuf_release(&errmsg);
530 diff_dirstat_permille_default = default_diff_options.dirstat_permille;
531 return 0;
532 }
533
534 if (git_diff_heuristic_config(var, value, cb) < 0)
535 return -1;

Callers 3

git_sequencer_configFunction · 0.85
git_diff_ui_configFunction · 0.85
git_stash_configFunction · 0.85

Calls 13

git_config_intFunction · 0.85
userdiff_configFunction · 0.85
parse_diff_color_slotFunction · 0.85
config_error_nonboolFunction · 0.85
color_parseFunction · 0.85
parse_ws_error_highlightFunction · 0.85
errorFunction · 0.85
git_config_boolFunction · 0.85
parse_dirstat_paramsFunction · 0.85
warningFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected