path: root/diffcore.h
diff options
authorJunio C Hamano <>2005-05-24 08:10:48 (GMT)
committerLinus Torvalds <>2005-05-24 08:26:26 (GMT)
commit25d5ea410fd528c13e5f56f7836ee8a3b839b168 (patch)
tree06e98a3d7cfef4675801dacaffc8aad0d251398a /diffcore.h
parent1e3f6b6e64511491d86ac7ce447ee26cea362d12 (diff)
[PATCH] Redo rename/copy detection logic.
Earlier implementation had a major screw-up in the memory management area. Rename/copy logic sometimes borrowed a pointer to a structure without any provision for downstream to determine which pointer is shared and which is not. This resulted in the later clean-up code to sometimes double free such structure, resulting in a segfault. This made -M and -C useless. Another problem the earlier implementation had was that it reordered the patches, and forced the logic to differentiate renames and copies to depend on that particular order. This problem was fixed by teaching rename/copy detection logic not to do any reordering, and rename-copy differentiator not to depend on the order of the patches. The diffs will leave rename/copy detector in the same destination path order as the patch that was fed into it. Some test vectors have been reordered to accommodate this change. It also adds a sanity check logic to the human-readable diff-raw output to detect paths with embedded TAB and LF characters, which cannot be expressed with that format. This idea came up during a discussion with Chris Wedgwood. Signed-off-by: Junio C Hamano <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'diffcore.h')
1 files changed, 11 insertions, 5 deletions
diff --git a/diffcore.h b/diffcore.h
index 1ffc78d..4610168 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -40,11 +40,6 @@ struct diff_filepair {
struct diff_filespec *one;
struct diff_filespec *two;
int score; /* only valid when one and two are different paths */
- int orig_order; /* the original order of insertion into the queue */
- int rename_rank; /* rename/copy dependency needs to enforce
- * certain ordering of patches that later
- * diffcore transformations should not break.
- */
int status; /* M C R N D U (see Documentation/diff-format.txt) */
@@ -67,4 +62,15 @@ extern void diff_q(struct diff_queue_struct *, struct diff_filepair *);
extern int diff_needs_to_stay(struct diff_queue_struct *, int,
struct diff_filespec *);
+#define DIFF_DEBUG 0
+void diff_debug_filespec(struct diff_filespec *, int, const char *);
+void diff_debug_filepair(const struct diff_filepair *, int);
+void diff_debug_queue(const char *, struct diff_queue_struct *);
+#define diff_debug_filespec(a,b,c) do {} while(0)
+#define diff_debug_filepair(a,b) do {} while(0)
+#define diff_debug_queue(a,b) do {} while(0)