git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* --find-copies-harder finds fewer copies/renames than -C does
@ 2011-01-05 17:46 Stefan Haller
  2011-01-05 18:59 ` Junio C Hamano
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Haller @ 2011-01-05 17:46 UTC (permalink / raw)
  To: git

I was surprised to find out that --find-copies-harder can, under certain
circumstances, detect fewer renames than -C does for a given commit.
After some digging I think I understand now why this is so, but I find
it extremely unintuitive, and would like to know what other people think
about it.  I had expected --find-copies-harder to always detect at least
as many copies/renames as -C, and possibly more, but never less.

The case I had is this: I have a repo with about 10.000 files, and a
commit with 14 files being moved to a different folder; half of them
where unmodified moves, the other half had one-line modifications
(similarity index 97% or so).

"git show -C --name-status <commit>" detects all 14 files as renames;
"git show --find-copies-harder --name-status <commit>" only shows the
unmodified moves as renames, the ones with modifications are shown as
delete plus add.

The reason for this seems to be the condition
"num_create * num_src > rename_limit * rename_limit" in diffcore_rename;
--find-copies-harder exeeds the limit, so it turns off inexact rename
dectection *completely*, while -C stays well below the limit.

I had expected --find-copies-harder to still do inexact rename detection
among the changed files in the commit in this case, and turn it off only
for the unmodified files; I'm not familiar enough with the code to tell
whether that would be easy to implement though.

Any thoughts?


-- 
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH] builtin/diff.c: remove duplicated call to diff_result_code()
@ 2011-03-22 21:45 Junio C Hamano
  2011-03-22 21:50 ` [PATCH 1/3] diffcore-rename: refactor "too many candidates" logic Junio C Hamano
  0 siblings, 1 reply; 14+ messages in thread
From: Junio C Hamano @ 2011-03-22 21:45 UTC (permalink / raw)
  To: git; +Cc: Jeff King

The return value from builtin_diff_files() is fed to diff_result_code()
by the caller, and all other callees like builtin_diff_index() do not
have their own call to diff_result_code().  Remove the duplicated one
from builtin_diff_files() and let the caller handle it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * This probably does not make a difference right now, but it will at
   the end of the rebased 'rename-degrade-cc-to-c' series.

 builtin/diff.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/builtin/diff.c b/builtin/diff.c
index 4c9deb2..171ac39 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -207,7 +207,6 @@ static void refresh_index_quietly(void)
 
 static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv)
 {
-	int result;
 	unsigned int options = 0;
 
 	while (1 < argc && argv[1][0] == '-') {
@@ -241,8 +240,7 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
 		perror("read_cache_preload");
 		return -1;
 	}
-	result = run_diff_files(revs, options);
-	return diff_result_code(&revs->diffopt, result);
+	return run_diff_files(revs, options);
 }
 
 int cmd_diff(int argc, const char **argv, const char *prefix)

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-03-23 18:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-05 17:46 --find-copies-harder finds fewer copies/renames than -C does Stefan Haller
2011-01-05 18:59 ` Junio C Hamano
2011-01-06 16:54   ` Stefan Haller
2011-01-06 20:42     ` Junio C Hamano
2011-01-06 21:50       ` [PATCH 0/3] Falling back "diff -C -C" to "diff -C" more gracefully Junio C Hamano
2011-01-06 21:50         ` [PATCH 1/3] diffcore-rename: refactor "too many candidates" logic Junio C Hamano
2011-01-06 21:50         ` [PATCH 2/3] diffcore-rename: record filepair for rename src Junio C Hamano
2011-01-06 21:50         ` [PATCH 3/3] diffcore-rename: fall back to -C when -C -C busts the rename limit Junio C Hamano
2011-01-06 22:28         ` [PATCH 0/3] Falling back "diff -C -C" to "diff -C" more gracefully Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2011-03-22 21:45 [PATCH] builtin/diff.c: remove duplicated call to diff_result_code() Junio C Hamano
2011-03-22 21:50 ` [PATCH 1/3] diffcore-rename: refactor "too many candidates" logic Junio C Hamano
2011-03-22 21:50   ` [PATCH 3/3] diffcore-rename: fall back to -C when -C -C busts the rename limit Junio C Hamano
2011-03-23 15:58     ` Jeff King
2011-03-23 16:41       ` Junio C Hamano
2011-03-23 16:50         ` Jeff King
2011-03-23 18:17       ` Jeff King

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).