5800f15a335ad2aeeac210f07eaf5b66310cd48e
1/*
2 * Copyright (C) 2005 Junio C Hamano
3 */
4#ifndef DIFF_H
5#define DIFF_H
6
7#define DIFF_FILE_CANON_MODE(mode) \
8 (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
9 S_ISLNK(mode) ? S_IFLNK : S_IFDIR)
10
11struct 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 setup;
25};
26
27extern void diff_addremove(struct diff_options *,
28 int addremove,
29 unsigned mode,
30 const unsigned char *sha1,
31 const char *base,
32 const char *path);
33
34extern void diff_change(struct diff_options *,
35 unsigned mode1, unsigned mode2,
36 const unsigned char *sha1,
37 const unsigned char *sha2,
38 const char *base, const char *path);
39
40extern void diff_unmerge(struct diff_options *,
41 const char *path);
42
43extern int diff_scoreopt_parse(const char *opt);
44
45#define DIFF_SETUP_REVERSE 1
46#define DIFF_SETUP_USE_CACHE 2
47#define DIFF_SETUP_USE_SIZE_CACHE 4
48
49extern void diff_setup(struct diff_options *);
50extern int diff_opt_parse(struct diff_options *, const char **, int);
51extern int diff_setup_done(struct diff_options *);
52
53#define DIFF_DETECT_RENAME 1
54#define DIFF_DETECT_COPY 2
55
56#define DIFF_PICKAXE_ALL 1
57
58extern void diffcore_std(struct diff_options *);
59
60extern void diffcore_std_no_resolve(struct diff_options *);
61
62#define COMMON_DIFF_OPTIONS_HELP \
63"\ncommon diff options:\n" \
64" -r diff recursively (only meaningful in diff-tree)\n" \
65" -z output diff-raw with lines terminated with NUL.\n" \
66" -p output patch format.\n" \
67" -u synonym for -p.\n" \
68" --name-only show only names of changed files.\n" \
69" --name-only-z\n" \
70" same as --name-only but terminate lines with NUL.\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" -O<file> reorder diffs according to the <file>.\n" \
78" -S<string> find filepair whose only one side contains the string.\n" \
79" --pickaxe-all\n" \
80" show all files diff when -S is used and hit is found.\n"
81
82extern int diff_queue_is_empty(void);
83
84#define DIFF_FORMAT_RAW 1
85#define DIFF_FORMAT_PATCH 2
86#define DIFF_FORMAT_NO_OUTPUT 3
87#define DIFF_FORMAT_NAME 4
88
89extern void diff_flush(struct diff_options*);
90
91/* diff-raw status letters */
92#define DIFF_STATUS_ADDED 'A'
93#define DIFF_STATUS_COPIED 'C'
94#define DIFF_STATUS_DELETED 'D'
95#define DIFF_STATUS_MODIFIED 'M'
96#define DIFF_STATUS_RENAMED 'R'
97#define DIFF_STATUS_TYPE_CHANGED 'T'
98#define DIFF_STATUS_UNKNOWN 'X'
99#define DIFF_STATUS_UNMERGED 'U'
100
101/* these are not diff-raw status letters proper, but used by
102 * diffcore-filter insn to specify additional restrictions.
103 */
104#define DIFF_STATUS_FILTER_AON 'A'
105#define DIFF_STATUS_FILTER_BROKEN 'B'
106
107#endif /* DIFF_H */