Merge branch 'jk/diff-compact-heuristic'
Patch output from "git diff" and friends has been tweaked to be more readable by using a blank line as a strong hint that the contents before and after it belong to a logically separate unit. * jk/diff-compact-heuristic: diff: undocument the compaction heuristic knobs for experimentation xdiff: implement empty line chunk heuristic xdiff: add recs_match helper function
This commit is contained in:
11
diff.c
11
diff.c
@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
static int diff_detect_rename_default;
|
||||
static int diff_compaction_heuristic = 1;
|
||||
static int diff_rename_limit_default = 400;
|
||||
static int diff_suppress_blank_empty;
|
||||
static int diff_use_color_default = -1;
|
||||
@ -189,6 +190,10 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
|
||||
diff_detect_rename_default = git_config_rename(var, value);
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(var, "diff.compactionheuristic")) {
|
||||
diff_compaction_heuristic = git_config_bool(var, value);
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(var, "diff.autorefreshindex")) {
|
||||
diff_auto_refresh_index = git_config_bool(var, value);
|
||||
return 0;
|
||||
@ -3278,6 +3283,8 @@ void diff_setup(struct diff_options *options)
|
||||
options->use_color = diff_use_color_default;
|
||||
options->detect_rename = diff_detect_rename_default;
|
||||
options->xdl_opts |= diff_algorithm;
|
||||
if (diff_compaction_heuristic)
|
||||
DIFF_XDL_SET(options, COMPACTION_HEURISTIC);
|
||||
|
||||
options->orderfile = diff_order_file_cfg;
|
||||
|
||||
@ -3798,6 +3805,10 @@ int diff_opt_parse(struct diff_options *options,
|
||||
DIFF_XDL_SET(options, IGNORE_WHITESPACE_AT_EOL);
|
||||
else if (!strcmp(arg, "--ignore-blank-lines"))
|
||||
DIFF_XDL_SET(options, IGNORE_BLANK_LINES);
|
||||
else if (!strcmp(arg, "--compaction-heuristic"))
|
||||
DIFF_XDL_SET(options, COMPACTION_HEURISTIC);
|
||||
else if (!strcmp(arg, "--no-compaction-heuristic"))
|
||||
DIFF_XDL_CLR(options, COMPACTION_HEURISTIC);
|
||||
else if (!strcmp(arg, "--patience"))
|
||||
options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
|
||||
else if (!strcmp(arg, "--histogram"))
|
||||
|
||||
Reference in New Issue
Block a user