Code

Merge branch 'fixes'
[git.git] / diff.h
1 /*
2  * Copyright (C) 2005 Junio C Hamano
3  */
4 #ifndef DIFF_H
5 #define DIFF_H
7 #define DIFF_FILE_CANON_MODE(mode) \
8         (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
9         S_ISLNK(mode) ? S_IFLNK : S_IFDIR)
11 struct diff_options {
12         const char **paths;
13         const char *filter;
14         const char *orderfile;
15         const char *pickaxe;
16         int break_opt;
17         int detect_rename;
18         int find_copies_harder;
19         int line_termination;
20         int output_format;
21         int pickaxe_opts;
22         int rename_score;
23         int reverse_diff;
24         int rename_limit;
25         int setup;
26 };
28 extern void diff_addremove(struct diff_options *,
29                            int addremove,
30                            unsigned mode,
31                            const unsigned char *sha1,
32                            const char *base,
33                            const char *path);
35 extern void diff_change(struct diff_options *,
36                         unsigned mode1, unsigned mode2,
37                         const unsigned char *sha1,
38                         const unsigned char *sha2,
39                         const char *base, const char *path);
41 extern void diff_unmerge(struct diff_options *,
42                          const char *path);
44 extern int diff_scoreopt_parse(const char *opt);
46 #define DIFF_SETUP_REVERSE              1
47 #define DIFF_SETUP_USE_CACHE            2
48 #define DIFF_SETUP_USE_SIZE_CACHE       4
50 extern void diff_setup(struct diff_options *);
51 extern int diff_opt_parse(struct diff_options *, const char **, int);
52 extern int diff_setup_done(struct diff_options *);
54 #define DIFF_DETECT_RENAME      1
55 #define DIFF_DETECT_COPY        2
57 #define DIFF_PICKAXE_ALL        1
59 extern void diffcore_std(struct diff_options *);
61 extern void diffcore_std_no_resolve(struct diff_options *);
63 #define COMMON_DIFF_OPTIONS_HELP \
64 "\ncommon diff options:\n" \
65 "  -r            diff recursively (only meaningful in diff-tree)\n" \
66 "  -z            output diff-raw with lines terminated with NUL.\n" \
67 "  -p            output patch format.\n" \
68 "  -u            synonym for -p.\n" \
69 "  --name-only   show only names of changed files.\n" \
70 "  --name-status show names and status of changed files.\n" \
71 "  -R            swap input file pairs.\n" \
72 "  -B            detect complete rewrites.\n" \
73 "  -M            detect renames.\n" \
74 "  -C            detect copies.\n" \
75 "  --find-copies-harder\n" \
76 "                try unchanged files as candidate for copy detection.\n" \
77 "  -l<n>         limit rename attempts up to <n> paths.\n" \
78 "  -O<file>      reorder diffs according to the <file>.\n" \
79 "  -S<string>    find filepair whose only one side contains the string.\n" \
80 "  --pickaxe-all\n" \
81 "                show all files diff when -S is used and hit is found.\n"
83 extern int diff_queue_is_empty(void);
85 #define DIFF_FORMAT_RAW         1
86 #define DIFF_FORMAT_PATCH       2
87 #define DIFF_FORMAT_NO_OUTPUT   3
88 #define DIFF_FORMAT_NAME        4
89 #define DIFF_FORMAT_NAME_STATUS 5
91 extern void diff_flush(struct diff_options*);
93 /* diff-raw status letters */
94 #define DIFF_STATUS_ADDED               'A'
95 #define DIFF_STATUS_COPIED              'C'
96 #define DIFF_STATUS_DELETED             'D'
97 #define DIFF_STATUS_MODIFIED            'M'
98 #define DIFF_STATUS_RENAMED             'R'
99 #define DIFF_STATUS_TYPE_CHANGED        'T'
100 #define DIFF_STATUS_UNKNOWN             'X'
101 #define DIFF_STATUS_UNMERGED            'U'
103 /* these are not diff-raw status letters proper, but used by
104  * diffcore-filter insn to specify additional restrictions.
105  */
106 #define DIFF_STATUS_FILTER_AON          '*'
107 #define DIFF_STATUS_FILTER_BROKEN       'B'
109 #endif /* DIFF_H */