git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>
Subject: [PATCH] diff.c: respect diff.renames config option
Date: Fri, 07 Jul 2006 03:10:44 -0700	[thread overview]
Message-ID: <11522670473116-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: <11522670452824-git-send-email-normalperson@yhbt.net>

diff.renames is mentioned several times in the documentation,
but to my surprise it didn't do anything before this patch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 Documentation/config.txt |    5 +++++
 diff.c                   |   12 ++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index f075f19..5290a8f 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -114,6 +114,11 @@ diff.renameLimit::
 	The number of files to consider when performing the copy/rename
 	detection; equivalent to the git diff option '-l'.
 
+diff.renames::
+	Tells git to detect renames.  If set to any boolean value, it
+	will enable basic rename detection.  If set to "copies" or
+	"copy", it will detect copies, as well.
+
 format.headers::
 	Additional email headers to include in a patch to be submitted
 	by mail.  See gitlink:git-format-patch[1].
diff --git a/diff.c b/diff.c
index 507e401..223622a 100644
--- a/diff.c
+++ b/diff.c
@@ -13,6 +13,7 @@ #include "xdiff-interface.h"
 
 static int use_size_cache;
 
+static int diff_detect_rename_default = 0;
 static int diff_rename_limit_default = -1;
 static int diff_use_color_default = 0;
 
@@ -120,6 +121,16 @@ int git_diff_config(const char *var, con
 			diff_use_color_default = git_config_bool(var, value);
 		return 0;
 	}
+	if (!strcmp(var, "diff.renames")) {
+		if (!value)
+			diff_detect_rename_default = DIFF_DETECT_RENAME;
+		else if (!strcasecmp(value, "copies") ||
+			 !strcasecmp(value, "copy"))
+			diff_detect_rename_default = DIFF_DETECT_COPY;
+		else
+			diff_detect_rename_default = git_config_bool(var,value);
+		return 0;
+	}
 	if (!strncmp(var, "diff.color.", 11)) {
 		int slot = parse_diff_color_slot(var, 11);
 		diff_colors[slot] = parse_diff_color_value(value, var);
@@ -1429,6 +1440,7 @@ void diff_setup(struct diff_options *opt
 	options->change = diff_change;
 	options->add_remove = diff_addremove;
 	options->color_diff = diff_use_color_default;
+	options->detect_rename = diff_detect_rename_default;
 }
 
 int diff_setup_done(struct diff_options *options)
-- 
1.4.1.g3dc65

  reply	other threads:[~2006-07-07 10:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07 10:10 [PATCH 0/1] I forgot to run format-patch with the -M flag Eric Wong
2006-07-07 10:10 ` Eric Wong [this message]
2006-07-07 10:10   ` [PATCH] builtin-log: respect diff configuration options Eric Wong
2006-07-07 10:43     ` Junio C Hamano
2006-07-07 10:22   ` [PATCH] diff.c: respect diff.renames config option Junio C Hamano
     [not found]     ` <20060707110123.GA23400@soma>
2006-07-07 11:18       ` Junio C Hamano
2006-07-07 12:17         ` Junio C Hamano
2006-07-08  1:58           ` [PATCH] Fix several places where diff.renames in config can be problematic Eric Wong
2006-07-08  8:05             ` Junio C Hamano
2006-07-08  8:41               ` Eric Wong
2006-07-08  8:50                 ` [PATCH] templates/hooks--update: replace diffstat calls with git diff --stat Eric Wong
2006-07-07 12:29         ` [PATCH] diff.c: respect diff.renames config option Junio C Hamano
2006-07-07 12:30         ` [PATCH] update Documentation/diff-options.txt Junio C Hamano

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=11522670473116-git-send-email-normalperson@yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).