{"thread":{"id":"30102","subject":"[PATCH] Add diff.minimal configuration setting","startedAt":"2012-03-29T20:26:48Z","lastAt":"2012-03-30T08:09:04Z","messageCount":2,"participants":["Victor Engmark","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"188094","messageId":"20120329202648.GA27318@l0b0x","threadId":"30102","inReplyTo":null,"subject":"[PATCH] Add diff.minimal configuration setting","fromName":"Victor Engmark","fromEmail":"victor.engmark@gmail.com","sentAt":"2012-03-29T20:26:48Z","receivedAt":"2012-03-29T20:26:48Z","isPatch":true,"sender":{"key":"victor.engmark@gmail.com","avatar":"https://gravatar.com/avatar/5d7b4229a48f2ed011a265c19a1881c4ee58946449215db6627373a244c8aa4c?d=mp&s=160"},"body":"Complements the --minimal and --no-minimal options.\n\nSigned-off-by: Victor Engmark <victor.engmark@gmail.com>\n---\n\nFollow-up from 8762g7u60j.fsf@thomas.inf.ethz.ch, for those with small\nprojects or cycles to spare. Since I couldn't `find t -iname\n'*minimal*'`, I'm a bit at a loss for how to test this - Does anyone\nhave a test diff that will for sure show up differently with\n--minimal?\n\nCheers,\nV\n\n Documentation/diff-config.txt          |    4 ++++\n Documentation/diff-options.txt         |    4 +++-\n contrib/completion/git-completion.bash |    1 +\n diff.c                                 |    6 ++++++\n diff.h                                 |    1 +\n 5 files changed, 15 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 6aa1be0..6fcc070 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -71,6 +71,10 @@ diff.ignoreSubmodules::\n \tcommands such as 'git diff-files'. 'git checkout' also honors\n \tthis setting when reporting uncommitted changes.\n \n+diff.minimal::\n+\tIf set, 'git diff' spends extra time to make sure the smallest\n+\tpossible diff is produced.\n+\n diff.mnemonicprefix::\n \tIf set, 'git diff' uses a prefix pair that is different from the\n \tstandard \"a/\" and \"b/\" depending on what is being compared.  When\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 378f19f..879e2fd 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -47,7 +47,9 @@ endif::git-format-patch[]\n \n --minimal::\n \tSpend extra time to make sure the smallest possible\n-\tdiff is produced.\n+\tdiff is produced. The default is controlled by the\n+\t`diff.minimal` configuration variable (see\n+\tlinkgit:git-config[1]).\n \n --patience::\n \tGenerate a diff using the \"patience diff\" algorithm.\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 31f714d..33ff2f4 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2096,6 +2096,7 @@ _git_config ()\n \t\tdiff.statGraphWidth\n \t\tdiff.external\n \t\tdiff.ignoreSubmodules\n+\t\tdiff.minimal\n \t\tdiff.mnemonicprefix\n \t\tdiff.noprefix\n \t\tdiff.renameLimit\ndiff --git a/diff.c b/diff.c\nindex 377ec1e..e3add82 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -29,6 +29,7 @@ int diff_use_color_default = -1;\n static const char *diff_word_regex_cfg;\n static const char *external_diff_cmd_cfg;\n int diff_auto_refresh_index = 1;\n+static int diff_minimal;\n static int diff_mnemonic_prefix;\n static int diff_no_prefix;\n static int diff_stat_graph_width;\n@@ -157,6 +158,10 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)\n \t\tdiff_no_prefix = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"diff.minimal\")) {\n+\t\tdiff_minimal = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n \tif (!strcmp(var, \"diff.statgraphwidth\")) {\n \t\tdiff_stat_graph_width = git_config_int(var, value);\n \t\treturn 0;\n@@ -3141,6 +3146,7 @@ void diff_setup(struct diff_options *options)\n \toptions->add_remove = diff_addremove;\n \toptions->use_color = diff_use_color_default;\n \toptions->detect_rename = diff_detect_rename_default;\n+\toptions->minimal = diff_minimal;\n \n \tif (diff_no_prefix) {\n \t\toptions->a_prefix = options->b_prefix = \"\";\ndiff --git a/diff.h b/diff.h\nindex cb68743..9bc67a8 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -118,6 +118,7 @@ struct diff_options {\n \tint rename_score;\n \tint rename_limit;\n \tint needed_rename_limit;\n+\tint minimal;\n \tint degraded_cc_to_c;\n \tint show_rename_progress;\n \tint dirstat_permille;\n-- \n1.7.5.4\n"},{"id":"188137","messageId":"20120330080904.GA2661@sigill.intra.peff.net","threadId":"30102","inReplyTo":"20120329202648.GA27318@l0b0x","subject":"Re: [PATCH] Add diff.minimal configuration setting","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-03-30T08:09:04Z","receivedAt":"2012-03-30T08:09:04Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 29, 2012 at 10:26:48PM +0200, Victor Engmark wrote:\n\n> Complements the --minimal and --no-minimal options.\n\nThere was a recent discussion here:\n\n  http://article.gmane.org/gmane.comp.version-control.git/192719\n\nwhere two similar options were considered:\n\n  1. diff.algorithm should be added, and consider \"minimal\" to be a\n     variant algorithm\n\n  2. we should have a generic \"diff options\" config variable, in which\n     one could put \"--minimal\", \"--patience\", or whatever.\n\nI don't think anything was decided, but either option would remove the\nneed for a separate diff.minimal variable. Maybe it would be worth\ncombining efforts.\n\n-Peff\n\nPS I like the generality of (2), but the idea of diff defaults came up a\n   few years ago, and I remember it devolving into quite a complex\n   patch. But that may also just have been the patch submitter, who\n   seemed very interested in complexifying things. I can dig up the\n   discussion if you want.\n"}]}