From: Victor Engmark <victor.engmark@gmail.com>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Thomas Rast <trast@student.ethz.ch>
Subject: [PATCH] Add diff.minimal configuration setting
Date: Thu, 29 Mar 2012 22:26:48 +0200 [thread overview]
Message-ID: <20120329202648.GA27318@l0b0x> (raw)
Complements the --minimal and --no-minimal options.
Signed-off-by: Victor Engmark <victor.engmark@gmail.com>
---
Follow-up from 8762g7u60j.fsf@thomas.inf.ethz.ch, 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
next reply other threads:[~2012-03-29 20:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-29 20:26 Victor Engmark [this message]
2012-03-30 8:09 ` [PATCH] Add diff.minimal configuration setting Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120329202648.GA27318@l0b0x \
--to=victor.engmark@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).