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
11extern void diff_addremove(int addremove,
12 unsigned mode,
13 const unsigned char *sha1,
14 const char *base,
15 const char *path);
16
17extern void diff_change(unsigned mode1, unsigned mode2,
18 const unsigned char *sha1,
19 const unsigned char *sha2,
20 const char *base, const char *path);
21
22extern void diff_unmerge(const char *path);
23
24extern int diff_scoreopt_parse(const char *opt);
25
26#define DIFF_SETUP_REVERSE 1
27#define DIFF_SETUP_USE_CACHE 2
28#define DIFF_SETUP_USE_SIZE_CACHE 4
29
30extern void diff_setup(int flags);
31
32#define DIFF_DETECT_RENAME 1
33#define DIFF_DETECT_COPY 2
34
35#define DIFF_PICKAXE_ALL 1
36
37extern void diffcore_std(const char **paths,
38 int detect_rename, int rename_score,
39 const char *pickaxe, int pickaxe_opts,
40 int break_opt,
41 const char *orderfile, const char *filter);
42
43extern void diffcore_std_no_resolve(const char **paths,
44 const char *pickaxe, int pickaxe_opts,
45 const char *orderfile, const char *filter);
46
47#define COMMON_DIFF_OPTIONS_HELP \
48"\ncommon diff options:\n" \
49" -r diff recursively (only meaningful in diff-tree)\n" \
50" -z output diff-raw with lines terminated with NUL.\n" \
51" -p output patch format.\n" \
52" -u synonym for -p.\n" \
53" --name-only show only names of changed files.\n" \
54" --name-only-z\n" \
55" same as --name-only but terminate lines with NUL.\n" \
56" -R swap input file pairs.\n" \
57" -B detect complete rewrites.\n" \
58" -M detect renames.\n" \
59" -C detect copies.\n" \
60" --find-copies-harder\n" \
61" try unchanged files as candidate for copy detection.\n" \
62" -O<file> reorder diffs according to the <file>.\n" \
63" -S<string> find filepair whose only one side contains the string.\n" \
64" --pickaxe-all\n" \
65" show all files diff when -S is used and hit is found.\n"
66
67extern int diff_queue_is_empty(void);
68
69#define DIFF_FORMAT_RAW 1
70#define DIFF_FORMAT_PATCH 2
71#define DIFF_FORMAT_NO_OUTPUT 3
72#define DIFF_FORMAT_NAME 4
73
74extern void diff_flush(int output_style, int line_terminator);
75
76/* diff-raw status letters */
77#define DIFF_STATUS_ADDED 'A'
78#define DIFF_STATUS_COPIED 'C'
79#define DIFF_STATUS_DELETED 'D'
80#define DIFF_STATUS_MODIFIED 'M'
81#define DIFF_STATUS_RENAMED 'R'
82#define DIFF_STATUS_TYPE_CHANGED 'T'
83#define DIFF_STATUS_UNKNOWN 'X'
84#define DIFF_STATUS_UNMERGED 'U'
85
86/* these are not diff-raw status letters proper, but used by
87 * diffcore-filter insn to specify additional restrictions.
88 */
89#define DIFF_STATUS_FILTER_AON 'A'
90#define DIFF_STATUS_FILTER_BROKEN 'B'
91
92#endif /* DIFF_H */