2 * Copyright (C) 2005 Junio C Hamano
7 /* This header file is internal between diff.c and its diff transformers
8 * (e.g. diffcore-rename, diffcore-pickaxe). Never include this header
11 #define MAX_SCORE 10000
12 #define DEFAULT_MINIMUM_SCORE 5000
14 #define RENAME_DST_MATCHED 01
16 struct diff_filespec
{
17 unsigned char sha1
[20];
21 int xfrm_flags
; /* for use by the xfrm */
22 unsigned short mode
; /* file mode */
23 unsigned sha1_valid
: 1; /* if true, use sha1 and trust mode;
24 * if false, use the name and read from
27 #define DIFF_FILE_VALID(spec) (((spec)->mode) != 0)
28 unsigned should_free
: 1; /* data should be free()'ed */
29 unsigned should_munmap
: 1; /* data should be munmap()'ed */
32 extern struct diff_filespec
*alloc_filespec(const char *);
33 extern void fill_filespec(struct diff_filespec
*, const unsigned char *,
36 extern int diff_populate_filespec(struct diff_filespec
*);
37 extern void diff_free_filespec_data(struct diff_filespec
*);
39 struct diff_filepair
{
40 struct diff_filespec
*one
;
41 struct diff_filespec
*two
;
42 int score
; /* only valid when one and two are different paths */
43 int orig_order
; /* the original order of insertion into the queue */
44 int rename_rank
; /* rename/copy dependency needs to enforce
45 * certain ordering of patches that later
46 * diffcore transformations should not break.
48 int status
; /* M C R N D U (see Documentation/diff-format.txt) */
50 #define DIFF_PAIR_UNMERGED(p) \
51 (!DIFF_FILE_VALID((p)->one) && !DIFF_FILE_VALID((p)->two))
53 extern int diff_unmodified_pair(struct diff_filepair
*);
55 struct diff_queue_struct
{
56 struct diff_filepair
**queue
;
61 extern struct diff_queue_struct diff_queued_diff
;
62 extern struct diff_filepair
*diff_queue(struct diff_queue_struct
*,
63 struct diff_filespec
*,
64 struct diff_filespec
*);
65 extern void diff_q(struct diff_queue_struct
*, struct diff_filepair
*);
67 extern int diff_needs_to_stay(struct diff_queue_struct
*, int,
68 struct diff_filespec
*);