Complements the --minimal and --no-minimal options. Signed-off-by: Victor Engmark <victor.engmark@xxxxxxxxx> --- Follow-up from 8762g7u60j.fsf@xxxxxxxxxxxxxxxxxx, for those with small projects or cycles to spare. Since I couldn't `find t -iname '*minimal*'`, I'm a bit at a loss for how to test this - Does anyone have a test diff that will for sure show up differently with --minimal? Cheers, V Documentation/diff-config.txt | 4 ++++ Documentation/diff-options.txt | 4 +++- contrib/completion/git-completion.bash | 1 + diff.c | 6 ++++++ diff.h | 1 + 5 files changed, 15 insertions(+), 1 deletions(-) diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt index 6aa1be0..6fcc070 100644 --- a/Documentation/diff-config.txt +++ b/Documentation/diff-config.txt @@ -71,6 +71,10 @@ diff.ignoreSubmodules:: commands such as 'git diff-files'. 'git checkout' also honors this setting when reporting uncommitted changes. +diff.minimal:: + If set, 'git diff' spends extra time to make sure the smallest + possible diff is produced. + diff.mnemonicprefix:: If set, 'git diff' uses a prefix pair that is different from the standard "a/" and "b/" depending on what is being compared. When diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 378f19f..879e2fd 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -47,7 +47,9 @@ endif::git-format-patch[] --minimal:: Spend extra time to make sure the smallest possible - diff is produced. + diff is produced. The default is controlled by the + `diff.minimal` configuration variable (see + linkgit:git-config[1]). --patience:: Generate a diff using the "patience diff" algorithm. diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 31f714d..33ff2f4 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2096,6 +2096,7 @@ _git_config () diff.statGraphWidth diff.external diff.ignoreSubmodules + diff.minimal diff.mnemonicprefix diff.noprefix diff.renameLimit diff --git a/diff.c b/diff.c index 377ec1e..e3add82 100644 --- a/diff.c +++ b/diff.c @@ -29,6 +29,7 @@ int diff_use_color_default = -1; static const char *diff_word_regex_cfg; static const char *external_diff_cmd_cfg; int diff_auto_refresh_index = 1; +static int diff_minimal; static int diff_mnemonic_prefix; static int diff_no_prefix; static int diff_stat_graph_width; @@ -157,6 +158,10 @@ int git_diff_ui_config(const char *var, const char *value, void *cb) diff_no_prefix = git_config_bool(var, value); return 0; } + if (!strcmp(var, "diff.minimal")) { + diff_minimal = git_config_bool(var, value); + return 0; + } if (!strcmp(var, "diff.statgraphwidth")) { diff_stat_graph_width = git_config_int(var, value); return 0; @@ -3141,6 +3146,7 @@ void diff_setup(struct diff_options *options) options->add_remove = diff_addremove; options->use_color = diff_use_color_default; options->detect_rename = diff_detect_rename_default; + options->minimal = diff_minimal; if (diff_no_prefix) { options->a_prefix = options->b_prefix = ""; diff --git a/diff.h b/diff.h index cb68743..9bc67a8 100644 --- a/diff.h +++ b/diff.h @@ -118,6 +118,7 @@ struct diff_options { int rename_score; int rename_limit; int needed_rename_limit; + int minimal; int degraded_cc_to_c; int show_rename_progress; int dirstat_permille; -- 1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html