Add diff.minimal configuration setting
PATCH 1/1 Add diff.minimal configuration setting
Complements the --minimal and --no-minimal options.
---
Follow-up from [email protected], 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(-)
Documentation/diff-config.txt +4 -0
@@ -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
Documentation/diff-options.txt +3 -1
@@ -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.
contrib/completion/git-completion.bash +1 -0
@@ -2096,6 +2096,7 @@ _git_config () diff.statGraphWidth diff.external diff.ignoreSubmodules + diff.minimal diff.mnemonicprefix diff.noprefix diff.renameLimit
diff.c +6 -0
@@ -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.h +1 -0
@@ -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;
Signature · 1 line
1.7.5.4
Quoted 1 line · Victor Engmark
Complements the --minimal and --no-minimal options.
There was a recent discussion here:
http://article.gmane.org/gmane.comp.version-control.git/192719
where two similar options were considered:
1. diff.algorithm should be added, and consider "minimal" to be a variant algorithm
2. we should have a generic "diff options" config variable, in which one could put "--minimal", "--patience", or whatever.
I don't think anything was decided, but either option would remove the need for a separate diff.minimal variable. Maybe it would be worth combining efforts.
-Peff
PS I like the generality of (2), but the idea of diff defaults came up a
few years ago, and I remember it devolving into quite a complex patch. But that may also just have been the patch submitter, who seemed very interested in complexifying things. I can dig up the discussion if you want.