summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9ca5df9)
raw | patch | inline | side by side (parent: 9ca5df9)
author | Bo Yang <struggleyb.nku@gmail.com> | |
Fri, 7 May 2010 04:52:28 +0000 (21:52 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 7 May 2010 16:34:28 +0000 (09:34 -0700) |
When file renames/copies detection is turned on, the
second diffcore_std will degrade a 'C' pair to a 'R' pair.
And this may happen when we run 'git log --follow' with
hard copies finding. That is, the try_to_follow_renames()
will run diffcore_std to find the copies, and then
'git log' will issue another diffcore_std, which will reduce
'src->rename_used' and recognize this copy as a rename.
This is not what we want.
So, I think we really don't need to run diffcore_std more
than one time.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
second diffcore_std will degrade a 'C' pair to a 'R' pair.
And this may happen when we run 'git log --follow' with
hard copies finding. That is, the try_to_follow_renames()
will run diffcore_std to find the copies, and then
'git log' will issue another diffcore_std, which will reduce
'src->rename_used' and recognize this copy as a rename.
This is not what we want.
So, I think we really don't need to run diffcore_std more
than one time.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c | patch | blob | history | |
diffcore.h | patch | blob | history |
index 4a350e365e5f4d0c61977546e620bf6b79679dd5..f0985bc76a84d7adc7dcc6b294a7a6e9cf90bf6b 100644 (file)
--- a/diff.c
+++ b/diff.c
void diffcore_std(struct diff_options *options)
{
+ /* We never run this function more than one time, because the
+ * rename/copy detection logic can only run once.
+ */
+ if (diff_queued_diff.run)
+ return;
+
if (options->skip_stat_unmatch)
diffcore_skip_stat_unmatch(options);
if (options->break_opt != -1)
DIFF_OPT_SET(options, HAS_CHANGES);
else
DIFF_OPT_CLR(options, HAS_CHANGES);
+
+ diff_queued_diff.run = 1;
}
int diff_result_code(struct diff_options *opt, int status)
diff --git a/diffcore.h b/diffcore.h
index 5d05deaf68b7c44a98456e9c0e12a7af2230f116..491bea0b44963461cfce30b07ec96a9005a3c910 100644 (file)
--- a/diffcore.h
+++ b/diffcore.h
struct diff_filepair **queue;
int alloc;
int nr;
+ int run;
};
#define DIFF_QUEUE_CLEAR(q) \
do { \
(q)->queue = NULL; \
(q)->nr = (q)->alloc = 0; \
+ (q)->run = 0; \
} while(0);
extern struct diff_queue_struct diff_queued_diff;