]> git.ipfire.org Git - thirdparty/git.git/blame - diff.h
Diff clean-up.
[thirdparty/git.git] / diff.h
CommitLineData
be3cfa85
JH
1/*
2 * Copyright (C) 2005 Junio C Hamano
3 */
86436c28
JH
4#ifndef DIFF_H
5#define DIFF_H
6
67574c40
JH
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
6b5ee137
JH
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,
77eb2720
JH
29 unsigned mode,
30 const unsigned char *sha1,
31 const char *base,
32 const char *path);
33
6b5ee137
JH
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);
77eb2720 39
6b5ee137
JH
40extern void diff_unmerge(struct diff_options *,
41 const char *path);
77eb2720 42
57fe64a4
JH
43extern int diff_scoreopt_parse(const char *opt);
44
19feebc8 45#define DIFF_SETUP_REVERSE 1
f0c6b2a2
JH
46#define DIFF_SETUP_USE_CACHE 2
47#define DIFF_SETUP_USE_SIZE_CACHE 4
ce240675 48
6b5ee137
JH
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 *);
86436c28 52
6b14d7fa
JH
53#define DIFF_DETECT_RENAME 1
54#define DIFF_DETECT_COPY 2
55
367cec1c 56#define DIFF_PICKAXE_ALL 1
f345b0a0 57
6b5ee137 58extern void diffcore_std(struct diff_options *);
f2ce9fde 59
6b5ee137 60extern void diffcore_std_no_resolve(struct diff_options *);
befe8639 61
dda2d79a
JH
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
38c6f780
JH
82extern int diff_queue_is_empty(void);
83
e68b6f15 84#define DIFF_FORMAT_RAW 1
19feebc8
JH
85#define DIFF_FORMAT_PATCH 2
86#define DIFF_FORMAT_NO_OUTPUT 3
52f28529 87#define DIFF_FORMAT_NAME 4
19feebc8 88
6b5ee137 89extern void diff_flush(struct diff_options*);
86436c28 90
e7baa4f4 91/* diff-raw status letters */
ca8c9156 92#define DIFF_STATUS_ADDED 'A'
e7baa4f4
JH
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
86436c28 107#endif /* DIFF_H */