summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f8348be)
raw | patch | inline | side by side (parent: f8348be)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 15 Nov 2005 20:48:08 +0000 (12:48 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 15 Nov 2005 23:08:27 +0000 (15:08 -0800) |
A while ago, a rename-detection limit logic was implemented as a
response to this thread:
http://marc.theaimsgroup.com/?l=git&m=112413080630175
where gitweb was found to be using a lot of time and memory to
detect renames on huge commits. git-diff family takes -l<num>
flag, and if the number of paths that are rename destination
candidates (i.e. new paths with -M, or modified paths with -C)
are larger than that number, skips rename/copy detection even
when -M or -C is specified on the command line.
This commit makes the rename detection limit easier to use. You
can have:
[diff]
renamelimit = 30
in your .git/config file to specify the default rename detection
limit. You can override this from the command line; giving 0
means 'unlimited':
git diff -M -l0
We might want to change the default behaviour, when you do not
have the configuration, to limit it to say 20 paths or so. This
would also help the diffstat generation after a big 'git pull'.
Signed-off-by: Junio C Hamano <junkio@cox.net>
response to this thread:
http://marc.theaimsgroup.com/?l=git&m=112413080630175
where gitweb was found to be using a lot of time and memory to
detect renames on huge commits. git-diff family takes -l<num>
flag, and if the number of paths that are rename destination
candidates (i.e. new paths with -M, or modified paths with -C)
are larger than that number, skips rename/copy detection even
when -M or -C is specified on the command line.
This commit makes the rename detection limit easier to use. You
can have:
[diff]
renamelimit = 30
in your .git/config file to specify the default rename detection
limit. You can override this from the command line; giving 0
means 'unlimited':
git diff -M -l0
We might want to change the default behaviour, when you do not
have the configuration, to limit it to say 20 paths or so. This
would also help the diffstat generation after a big 'git pull'.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Makefile | patch | blob | history | |
cache.h | patch | blob | history | |
config.c | patch | blob | history | |
diff.c | patch | blob | history | |
diffcore-rename.c | patch | blob | history |
diff --git a/Makefile b/Makefile
index b10a31550ade6a522b23356fbdde19d953e09613..21bc3d384e0cfe7ae4d639e71b7448215af8b6e4 100644 (file)
--- a/Makefile
+++ b/Makefile
# 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 = \
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
index 9a6bfb96d9d0f4e8316dbbe60469988cf48f197b..08461cfc5a71b8c43f4774de0da897ed2aa3e6ad 100644 (file)
--- a/cache.h
+++ b/cache.h
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 bd35138daec12366193bf6e2b95399ef8287d205..915bb9752374b8d11883fbe5da976e71e1b1af60 100644 (file)
--- a/config.c
+++ b/config.c
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;
}
index ec94a96a5d02fe4204cc69f03de2966264378f75..fca61f32f07fae0fb2e5f83e268ebce293a06ec5 100644 (file)
--- a/diff.c
+++ b/diff.c
static int use_size_cache;
+int diff_rename_limit_default = -1;
+
static char *quote_one(const char *str)
{
int needlen;
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 e17dd90058443ea75321f8c48818bd0094bd76a3..6a9d95d0593f26c5e698c5e593a9efc287c8e399 100644 (file)
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
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