| 358 | } |
| 359 | |
| 360 | int git_diff_ui_config(const char *var, const char *value, |
| 361 | const struct config_context *ctx, void *cb) |
| 362 | { |
| 363 | if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) { |
| 364 | diff_use_color_default = git_config_colorbool(var, value); |
| 365 | return 0; |
| 366 | } |
| 367 | if (!strcmp(var, "diff.colormoved")) { |
| 368 | int cm = parse_color_moved(value); |
| 369 | if (cm < 0) |
| 370 | return -1; |
| 371 | diff_color_moved_default = cm; |
| 372 | return 0; |
| 373 | } |
| 374 | if (!strcmp(var, "diff.colormovedws")) { |
| 375 | unsigned cm; |
| 376 | if (!value) |
| 377 | return config_error_nonbool(var); |
| 378 | cm = parse_color_moved_ws(value); |
| 379 | if (cm & COLOR_MOVED_WS_ERROR) |
| 380 | return -1; |
| 381 | diff_color_moved_ws_default = cm; |
| 382 | return 0; |
| 383 | } |
| 384 | if (!strcmp(var, "diff.context")) { |
| 385 | int val = git_config_int(var, value, ctx->kvi); |
| 386 | if (val < 0) |
| 387 | return -1; |
| 388 | diff_context_default = val; |
| 389 | return 0; |
| 390 | } |
| 391 | if (!strcmp(var, "diff.interhunkcontext")) { |
| 392 | int val = git_config_int(var, value, ctx->kvi); |
| 393 | if (val < 0) |
| 394 | return -1; |
| 395 | diff_interhunk_context_default = val; |
| 396 | return 0; |
| 397 | } |
| 398 | if (!strcmp(var, "diff.renames")) { |
| 399 | diff_detect_rename_default = git_config_rename(var, value); |
| 400 | return 0; |
| 401 | } |
| 402 | if (!strcmp(var, "diff.autorefreshindex")) { |
| 403 | diff_auto_refresh_index = git_config_bool(var, value); |
| 404 | return 0; |
| 405 | } |
| 406 | if (!strcmp(var, "diff.mnemonicprefix")) { |
| 407 | diff_mnemonic_prefix = git_config_bool(var, value); |
| 408 | return 0; |
| 409 | } |
| 410 | if (!strcmp(var, "diff.noprefix")) { |
| 411 | diff_no_prefix = git_config_bool(var, value); |
| 412 | return 0; |
| 413 | } |
| 414 | if (!strcmp(var, "diff.srcprefix")) { |
| 415 | FREE_AND_NULL(diff_src_prefix); |
| 416 | return git_config_string(&diff_src_prefix, var, value); |
| 417 | } |
no test coverage detected