summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--cache.h1
-rw-r--r--config.c5
-rw-r--r--diff.c9
-rw-r--r--diffcore-rename.c2
5 files changed, 16 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b10a315..21bc3d3 100644
--- a/Makefile
+++ b/Makefile
@@ -105,7 +105,7 @@ SCRIPT_PYTHON = \
# The ones that do not have to link with lcrypto nor lz.
SIMPLE_PROGRAMS = \
git-get-tar-commit-id$X git-mailinfo$X git-mailsplit$X \
- git-stripspace$X git-var$X git-daemon$X
+ git-stripspace$X git-daemon$X
# ... and all the rest
PROGRAMS = \
@@ -125,7 +125,7 @@ PROGRAMS = \
git-unpack-objects$X git-update-index$X git-update-server-info$X \
git-upload-pack$X git-verify-pack$X git-write-tree$X \
git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \
- git-name-rev$X git-pack-redundant$X $(SIMPLE_PROGRAMS)
+ git-name-rev$X git-pack-redundant$X git-var$X $(SIMPLE_PROGRAMS)
# Backward compatibility -- to be removed after 1.0
PROGRAMS += git-ssh-pull$X git-ssh-push$X
diff --git a/cache.h b/cache.h
index 9a6bfb9..08461cf 100644
--- a/cache.h
+++ b/cache.h
@@ -180,6 +180,7 @@ extern void rollback_index_file(struct cache_file *);
extern int trust_executable_bit;
extern int only_use_symrefs;
+extern int diff_rename_limit_default;
#define MTIME_CHANGED 0x0001
#define CTIME_CHANGED 0x0002
diff --git a/config.c b/config.c
index bd35138..915bb97 100644
--- a/config.c
+++ b/config.c
@@ -229,6 +229,11 @@ int git_default_config(const char *var, const char *value)
return 0;
}
+ if (!strcmp(var, "diff.renamelimit")) {
+ diff_rename_limit_default = git_config_int(var, value);
+ return 0;
+ }
+
/* Add other config variables here.. */
return 0;
}
diff --git a/diff.c b/diff.c
index ec94a96..fca61f3 100644
--- a/diff.c
+++ b/diff.c
@@ -13,6 +13,8 @@ static const char *diff_opts = "-pu";
static int use_size_cache;
+int diff_rename_limit_default = -1;
+
static char *quote_one(const char *str)
{
int needlen;
@@ -761,9 +763,12 @@ void diff_setup(struct diff_options *options)
int diff_setup_done(struct diff_options *options)
{
- if ((options->find_copies_harder || 0 <= options->rename_limit) &&
- options->detect_rename != DIFF_DETECT_COPY)
+ if ((options->find_copies_harder &&
+ options->detect_rename != DIFF_DETECT_COPY) ||
+ (0 <= options->rename_limit && !options->detect_rename))
return -1;
+ if (options->detect_rename && options->rename_limit < 0)
+ options->rename_limit = diff_rename_limit_default;
if (options->setup & DIFF_SETUP_USE_CACHE) {
if (!active_cache)
/* read-cache does not die even when it fails
diff --git a/diffcore-rename.c b/diffcore-rename.c
index e17dd90..6a9d95d 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -283,7 +283,7 @@ void diffcore_rename(struct diff_options *options)
register_rename_src(p->one, 1);
}
if (rename_dst_nr == 0 ||
- (0 <= rename_limit && rename_limit < rename_dst_nr))
+ (0 < rename_limit && rename_limit < rename_dst_nr))
goto cleanup; /* nothing to do */
/* We really want to cull the candidates list early