blob: b4a624d235748bf13be44e7479f086880dcf574f [file] [log] [blame]
Junio C Hamanobe3cfa82005-04-26 09:25:05 -07001/*
2 * Copyright (C) 2005 Junio C Hamano
3 */
Junio C Hamano86436c22005-04-25 18:22:47 -07004#ifndef DIFF_H
5#define DIFF_H
6
Junio C Hamano1b0c7172006-03-29 22:55:43 -08007#include "tree-walk.h"
Nguyễn Thái Ngọc Duy64acde92013-07-14 15:35:25 +07008#include "pathspec.h"
Linus Torvalds50f9a852006-01-31 14:10:56 -08009
Linus Torvalds91539832006-04-17 11:59:32 -070010struct rev_info;
Linus Torvaldsac1b3d12005-10-20 21:05:05 -070011struct diff_options;
Jeff King04245582006-09-07 02:35:42 -040012struct diff_queue_struct;
Bo Yanga3c158d2010-05-26 15:08:02 +080013struct strbuf;
Axel Bonneta788d7d2010-06-07 17:23:36 +020014struct diff_filespec;
15struct userdiff_driver;
René Scharfe0041f092011-12-17 11:15:48 +010016struct sha1_array;
René Scharfe82889292011-12-17 11:20:07 +010017struct commit;
Kirill Smelkov72441af2014-04-07 01:46:26 +040018struct combine_diff_path;
19
20typedef int (*pathchange_fn_t)(struct diff_options *options,
21 struct combine_diff_path *path);
Linus Torvaldsac1b3d12005-10-20 21:05:05 -070022
23typedef void (*change_fn_t)(struct diff_options *options,
24 unsigned old_mode, unsigned new_mode,
25 const unsigned char *old_sha1,
26 const unsigned char *new_sha1,
Jeff Kinge5450102012-07-28 11:03:01 -040027 int old_sha1_valid, int new_sha1_valid,
Jens Lehmanne3d42c42010-01-18 21:26:18 +010028 const char *fullpath,
29 unsigned old_dirty_submodule, unsigned new_dirty_submodule);
Linus Torvaldsac1b3d12005-10-20 21:05:05 -070030
31typedef void (*add_remove_fn_t)(struct diff_options *options,
32 int addremove, unsigned mode,
33 const unsigned char *sha1,
Jeff Kinge5450102012-07-28 11:03:01 -040034 int sha1_valid,
Jens Lehmanne3d42c42010-01-18 21:26:18 +010035 const char *fullpath, unsigned dirty_submodule);
Linus Torvaldsac1b3d12005-10-20 21:05:05 -070036
Jeff King04245582006-09-07 02:35:42 -040037typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
38 struct diff_options *options, void *data);
39
Bo Yanga3c158d2010-05-26 15:08:02 +080040typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data);
41
Timo Hirvonenc6744342006-06-24 20:21:53 +030042#define DIFF_FORMAT_RAW 0x0001
43#define DIFF_FORMAT_DIFFSTAT 0x0002
Junio C Hamano74e2abe2006-10-12 03:01:00 -070044#define DIFF_FORMAT_NUMSTAT 0x0004
45#define DIFF_FORMAT_SUMMARY 0x0008
46#define DIFF_FORMAT_PATCH 0x0010
Nicolas Pitreebd124c2006-12-14 23:15:44 -050047#define DIFF_FORMAT_SHORTSTAT 0x0020
Linus Torvalds7df7c012008-02-12 13:26:31 -080048#define DIFF_FORMAT_DIRSTAT 0x0040
Timo Hirvonenc6744342006-06-24 20:21:53 +030049
50/* These override all above */
Junio C Hamano74e2abe2006-10-12 03:01:00 -070051#define DIFF_FORMAT_NAME 0x0100
52#define DIFF_FORMAT_NAME_STATUS 0x0200
53#define DIFF_FORMAT_CHECKDIFF 0x0400
Timo Hirvonenc6744342006-06-24 20:21:53 +030054
55/* Same as output_format = 0 but we know that -s flag was given
56 * and we should not give default value to output_format.
57 */
Junio C Hamano74e2abe2006-10-12 03:01:00 -070058#define DIFF_FORMAT_NO_OUTPUT 0x0800
Timo Hirvonenc6744342006-06-24 20:21:53 +030059
Junio C Hamano74e2abe2006-10-12 03:01:00 -070060#define DIFF_FORMAT_CALLBACK 0x1000
Jeff King04245582006-09-07 02:35:42 -040061
Pierre Habouzit8f67f8a2007-11-10 20:05:14 +010062#define DIFF_OPT_RECURSIVE (1 << 0)
63#define DIFF_OPT_TREE_IN_RECURSIVE (1 << 1)
64#define DIFF_OPT_BINARY (1 << 2)
65#define DIFF_OPT_TEXT (1 << 3)
66#define DIFF_OPT_FULL_INDEX (1 << 4)
67#define DIFF_OPT_SILENT_ON_REMOVE (1 << 5)
68#define DIFF_OPT_FIND_COPIES_HARDER (1 << 6)
69#define DIFF_OPT_FOLLOW_RENAMES (1 << 7)
Jeff King90d43b02012-03-22 18:52:13 -040070#define DIFF_OPT_RENAME_EMPTY (1 << 8)
Thomas Rast882749a2010-04-14 17:59:06 +020071/* (1 << 9) unused */
Pierre Habouzit8f67f8a2007-11-10 20:05:14 +010072#define DIFF_OPT_HAS_CHANGES (1 << 10)
Junio C Hamano90b19942009-05-23 01:15:35 -070073#define DIFF_OPT_QUICK (1 << 11)
Pierre Habouzit8f67f8a2007-11-10 20:05:14 +010074#define DIFF_OPT_NO_INDEX (1 << 12)
75#define DIFF_OPT_ALLOW_EXTERNAL (1 << 13)
76#define DIFF_OPT_EXIT_WITH_STATUS (1 << 14)
77#define DIFF_OPT_REVERSE_DIFF (1 << 15)
Wincent Colaiuta62c64892007-12-13 21:24:52 +010078#define DIFF_OPT_CHECK_FAILED (1 << 16)
Junio C Hamanocd676a52008-02-12 14:26:02 -080079#define DIFF_OPT_RELATIVE_NAME (1 << 17)
Johannes Schindelin50fd9bd2008-05-14 18:03:31 +010080#define DIFF_OPT_IGNORE_SUBMODULES (1 << 18)
Junio C Hamanof88d2252008-09-02 17:28:59 -070081#define DIFF_OPT_DIRSTAT_CUMULATIVE (1 << 19)
Heikki Orsilafd337772008-09-05 22:27:35 +030082#define DIFF_OPT_DIRSTAT_BY_FILE (1 << 20)
Jeff Kingc7534ef2008-10-26 00:45:55 -040083#define DIFF_OPT_ALLOW_TEXTCONV (1 << 21)
Junio C Hamanof2451942009-05-22 12:45:29 -070084#define DIFF_OPT_DIFF_FROM_CONTENTS (1 << 22)
Johannes Schindelin752c0c22009-10-19 14:38:32 +020085#define DIFF_OPT_SUBMODULE_LOG (1 << 23)
Jens Lehmann9297f77e62010-03-08 13:53:19 +010086#define DIFF_OPT_DIRTY_SUBMODULES (1 << 24)
Jens Lehmann3bfc4502010-03-13 23:00:27 +010087#define DIFF_OPT_IGNORE_UNTRACKED_IN_SUBMODULES (1 << 25)
Junio C Hamano4af574d2010-06-27 12:07:44 -070088#define DIFF_OPT_IGNORE_DIRTY_SUBMODULES (1 << 26)
Jens Lehmannaee9c7d2010-08-06 00:39:25 +020089#define DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG (1 << 27)
Johan Herland1c57a622011-04-29 11:36:21 +020090#define DIFF_OPT_DIRSTAT_BY_LINE (1 << 28)
René Scharfe14937c22011-10-09 13:36:57 +020091#define DIFF_OPT_FUNCCONTEXT (1 << 29)
Junio C Hamanoaccccde2012-02-21 01:02:46 -080092#define DIFF_OPT_PICKAXE_IGNORE_CASE (1 << 30)
Johannes Schindelin752c0c22009-10-19 14:38:32 +020093
Pierre Habouzit8f67f8a2007-11-10 20:05:14 +010094#define DIFF_OPT_TST(opts, flag) ((opts)->flags & DIFF_OPT_##flag)
Junio C Hamano6c374002013-05-10 17:10:11 +020095#define DIFF_OPT_TOUCHED(opts, flag) ((opts)->touched_flags & DIFF_OPT_##flag)
96#define DIFF_OPT_SET(opts, flag) (((opts)->flags |= DIFF_OPT_##flag),((opts)->touched_flags |= DIFF_OPT_##flag))
97#define DIFF_OPT_CLR(opts, flag) (((opts)->flags &= ~DIFF_OPT_##flag),((opts)->touched_flags |= DIFF_OPT_##flag))
Keith Cascio628d5c22009-02-16 19:26:49 -080098#define DIFF_XDL_TST(opts, flag) ((opts)->xdl_opts & XDF_##flag)
99#define DIFF_XDL_SET(opts, flag) ((opts)->xdl_opts |= XDF_##flag)
100#define DIFF_XDL_CLR(opts, flag) ((opts)->xdl_opts &= ~XDF_##flag)
Pierre Habouzit8f67f8a2007-11-10 20:05:14 +0100101
Junio C Hamano307ab202012-02-19 15:36:55 -0800102#define DIFF_WITH_ALG(opts, flag) (((opts)->xdl_opts & ~XDF_DIFF_ALGORITHM_MASK) | XDF_##flag)
103
Thomas Rast882749a2010-04-14 17:59:06 +0200104enum diff_words_type {
105 DIFF_WORDS_NONE = 0,
106 DIFF_WORDS_PORCELAIN,
107 DIFF_WORDS_PLAIN,
108 DIFF_WORDS_COLOR
109};
110
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700111struct diff_options {
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700112 const char *orderfile;
113 const char *pickaxe;
Junio C Hamano2f3f8b22006-11-02 00:02:11 -0800114 const char *single_follow;
Johannes Schindelineab9a402007-12-18 19:32:14 +0000115 const char *a_prefix, *b_prefix;
Pierre Habouzit8f67f8a2007-11-10 20:05:14 +0100116 unsigned flags;
Junio C Hamano6c374002013-05-10 17:10:11 +0200117 unsigned touched_flags;
Junio C Hamano1ecc1cb2013-07-17 15:05:46 -0700118
119 /* diff-filter bits */
120 unsigned int filter;
121
Jeff Kingf1c96262011-08-17 22:03:12 -0700122 int use_color;
Linus Torvaldsee1e5412006-05-13 13:23:48 -0700123 int context;
René Scharfe6d0e6742008-12-28 19:45:32 +0100124 int interhunkcontext;
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700125 int break_opt;
126 int detect_rename;
Junio C Hamano467ddc12011-02-28 16:11:55 -0800127 int irreversible_delete;
Junio C Hamanofb132272007-08-03 13:33:31 -0700128 int skip_stat_unmatch;
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700129 int line_termination;
130 int output_format;
131 int pickaxe_opts;
132 int rename_score;
Junio C Hamano8082d8d2005-09-21 00:18:27 -0700133 int rename_limit;
Jeff Kingbf0ab102011-02-19 05:20:51 -0500134 int needed_rename_limit;
Junio C Hamanof31027c2011-01-06 13:50:06 -0800135 int degraded_cc_to_c;
Jeff King3ac942d2011-02-20 04:51:16 -0500136 int show_rename_progress;
Johan Herland712d2c72011-04-29 11:36:20 +0200137 int dirstat_permille;
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700138 int setup;
Junio C Hamano47dd0d52005-12-13 17:21:41 -0800139 int abbrev;
Junio C Hamanocd676a52008-02-12 14:26:02 -0800140 const char *prefix;
141 int prefix_length;
Johannes Schindelin698ce6f2006-05-20 15:40:29 +0200142 const char *stat_sep;
Johannes Schindelin0d21efa2006-06-14 17:40:23 +0200143 long xdl_opts;
Linus Torvaldsac1b3d12005-10-20 21:05:05 -0700144
Junio C Hamanoa2540022006-09-26 18:53:02 -0700145 int stat_width;
146 int stat_name_width;
Zbigniew Jędrzejewski-Szmek969fe572012-03-01 13:26:45 +0100147 int stat_graph_width;
Michael J Gruber808e1db2011-05-27 14:36:41 +0200148 int stat_count;
Johannes Schindelin2b6a5412009-01-17 17:29:45 +0100149 const char *word_regex;
Thomas Rast882749a2010-04-14 17:59:06 +0200150 enum diff_words_type word_diff;
Junio C Hamanoa2540022006-09-26 18:53:02 -0700151
Johannes Schindelin34a5e1a2007-02-25 23:34:54 +0100152 /* this is set by diffcore for DIFF_FORMAT_PATCH */
153 int found_changes;
154
Junio C Hamano44c48a92010-08-13 12:17:45 -0700155 /* to support internal diff recursion by --follow hack*/
156 int found_follow;
157
Junio C Hamano6c374002013-05-10 17:10:11 +0200158 void (*set_default)(struct diff_options *);
159
Daniel Barkalowc0c77732008-03-09 22:43:39 -0400160 FILE *file;
161 int close_file;
162
Nguyễn Thái Ngọc Duy66f13622010-12-15 22:02:38 +0700163 struct pathspec pathspec;
Kirill Smelkov72441af2014-04-07 01:46:26 +0400164 pathchange_fn_t pathchange;
Linus Torvaldsac1b3d12005-10-20 21:05:05 -0700165 change_fn_t change;
166 add_remove_fn_t add_remove;
Jeff King04245582006-09-07 02:35:42 -0400167 diff_format_fn_t format_callback;
168 void *format_callback_data;
Bo Yanga3c158d2010-05-26 15:08:02 +0800169 diff_prefix_fn_t output_prefix;
Lucian Poston5e71a842012-04-16 03:44:50 -0700170 int output_prefix_length;
Bo Yanga3c158d2010-05-26 15:08:02 +0800171 void *output_prefix_data;
Zoltan Klingeree7fb0b2013-12-06 10:38:46 +1100172
173 int diff_path_counter;
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700174};
175
Jeff Kingce436972006-07-23 05:24:18 -0400176enum color_diff {
177 DIFF_RESET = 0,
178 DIFF_PLAIN = 1,
179 DIFF_METAINFO = 2,
180 DIFF_FRAGINFO = 3,
181 DIFF_FILE_OLD = 4,
182 DIFF_FILE_NEW = 5,
183 DIFF_COMMIT = 6,
Junio C Hamano448c3ef2006-09-22 22:48:39 -0700184 DIFF_WHITESPACE = 7,
Gary V. Vaughan4b055482010-05-14 09:31:35 +0000185 DIFF_FUNCINFO = 8
Jeff Kingce436972006-07-23 05:24:18 -0400186};
187const char *diff_get_color(int diff_use_color, enum color_diff ix);
Pierre Habouzit8f67f8a2007-11-10 20:05:14 +0100188#define diff_get_color_opt(o, ix) \
Jeff Kingf1c96262011-08-17 22:03:12 -0700189 diff_get_color((o)->use_color, ix)
Pierre Habouzit8f67f8a2007-11-10 20:05:14 +0100190
Jeff Kingce436972006-07-23 05:24:18 -0400191
John Keepingf1922232013-02-07 20:15:26 +0000192const char *diff_line_prefix(struct diff_options *);
193
194
Johannes Schindelin698ce6f2006-05-20 15:40:29 +0200195extern const char mime_boundary_leader[];
196
Kirill Smelkov72441af2014-04-07 01:46:26 +0400197extern struct combine_diff_path *diff_tree_paths(
198 struct combine_diff_path *p, const unsigned char *sha1,
199 const unsigned char **parent_sha1, int nparent,
200 struct strbuf *base, struct diff_options *opt);
Linus Torvaldsac1b3d12005-10-20 21:05:05 -0700201extern int diff_tree_sha1(const unsigned char *old, const unsigned char *new,
202 const char *base, struct diff_options *opt);
Rene Scharfe2b603562006-10-26 18:52:39 +0200203extern int diff_root_tree_sha1(const unsigned char *new, const char *base,
204 struct diff_options *opt);
Linus Torvaldsac1b3d12005-10-20 21:05:05 -0700205
Junio C Hamanoea726d02006-01-28 00:03:38 -0800206struct combine_diff_path {
207 struct combine_diff_path *next;
Junio C Hamanoea726d02006-01-28 00:03:38 -0800208 char *path;
Junio C Hamano2454c962006-02-06 12:53:07 -0800209 unsigned int mode;
Junio C Hamanoea726d02006-01-28 00:03:38 -0800210 unsigned char sha1[20];
Junio C Hamano2454c962006-02-06 12:53:07 -0800211 struct combine_diff_parent {
Junio C Hamanod416df82006-02-10 02:30:52 -0800212 char status;
Junio C Hamano2454c962006-02-06 12:53:07 -0800213 unsigned int mode;
214 unsigned char sha1[20];
215 } parent[FLEX_ARRAY];
Junio C Hamanoea726d02006-01-28 00:03:38 -0800216};
Junio C Hamano2454c962006-02-06 12:53:07 -0800217#define combine_diff_path_size(n, l) \
218 (sizeof(struct combine_diff_path) + \
219 sizeof(struct combine_diff_parent) * (n) + (l) + 1)
Junio C Hamanoea726d02006-01-28 00:03:38 -0800220
Linus Torvalds91539832006-04-17 11:59:32 -0700221extern void show_combined_diff(struct combine_diff_path *elem, int num_parent,
222 int dense, struct rev_info *);
Junio C Hamanoea726d02006-01-28 00:03:38 -0800223
René Scharfe0041f092011-12-17 11:15:48 +0100224extern void diff_tree_combined(const unsigned char *sha1, const struct sha1_array *parents, int dense, struct rev_info *rev);
Junio C Hamano0fe7c1d2006-04-29 01:24:49 -0700225
René Scharfe82889292011-12-17 11:20:07 +0100226extern void diff_tree_combined_merge(const struct commit *commit, int dense, struct rev_info *rev);
Junio C Hamanoaf3feef2006-01-24 01:22:04 -0800227
Junio C Hamanoa5a818e2008-08-18 20:08:09 -0700228void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
229
Junio C Hamano28b92642011-05-31 09:14:17 -0700230extern int diff_can_quit_early(struct diff_options *);
231
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700232extern void diff_addremove(struct diff_options *,
233 int addremove,
Junio C Hamano77eb2722005-04-27 09:21:00 -0700234 unsigned mode,
235 const unsigned char *sha1,
Jeff Kinge5450102012-07-28 11:03:01 -0400236 int sha1_valid,
Jens Lehmanne3d42c42010-01-18 21:26:18 +0100237 const char *fullpath, unsigned dirty_submodule);
Junio C Hamano77eb2722005-04-27 09:21:00 -0700238
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700239extern void diff_change(struct diff_options *,
240 unsigned mode1, unsigned mode2,
241 const unsigned char *sha1,
242 const unsigned char *sha2,
Jeff Kinge5450102012-07-28 11:03:01 -0400243 int sha1_valid,
244 int sha2_valid,
Jens Lehmanne3d42c42010-01-18 21:26:18 +0100245 const char *fullpath,
246 unsigned dirty_submodule1, unsigned dirty_submodule2);
Junio C Hamano77eb2722005-04-27 09:21:00 -0700247
Junio C Hamanofa7b2902011-04-22 16:05:58 -0700248extern struct diff_filepair *diff_unmerge(struct diff_options *, const char *path);
Junio C Hamano77eb2722005-04-27 09:21:00 -0700249
Junio C Hamano19feebc2005-05-27 15:54:37 -0700250#define DIFF_SETUP_REVERSE 1
Junio C Hamanof0c6b2a2005-05-27 15:56:38 -0700251#define DIFF_SETUP_USE_CACHE 2
252#define DIFF_SETUP_USE_SIZE_CACHE 4
Junio C Hamanoce240672005-06-03 01:36:43 -0700253
Matthieu Moydea007f2010-08-05 10:22:52 +0200254/*
Nicolas Vigierb0d12fc2013-10-31 12:08:28 +0100255 * Poor man's alternative to parse-option, to allow both stuck form
Matthieu Moydea007f2010-08-05 10:22:52 +0200256 * (--option=value) and separate form (--option value).
257 */
258extern int parse_long_opt(const char *opt, const char **argv,
259 const char **optarg);
260
Johannes Schindelinef90d6d2008-05-14 18:46:53 +0100261extern int git_diff_basic_config(const char *var, const char *value, void *cb);
262extern int git_diff_ui_config(const char *var, const char *value, void *cb);
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700263extern void diff_setup(struct diff_options *);
264extern int diff_opt_parse(struct diff_options *, const char **, int);
Thomas Rast28452652012-08-03 14:16:24 +0200265extern void diff_setup_done(struct diff_options *);
Junio C Hamano86436c22005-04-25 18:22:47 -0700266
Junio C Hamano6b14d7f2005-05-22 10:04:37 -0700267#define DIFF_DETECT_RENAME 1
268#define DIFF_DETECT_COPY 2
269
Junio C Hamano367cec12005-05-27 15:55:28 -0700270#define DIFF_PICKAXE_ALL 1
Petr Baudisd01d8c62006-03-29 02:16:33 +0200271#define DIFF_PICKAXE_REGEX 2
Junio C Hamanof345b0a2005-05-30 00:08:37 -0700272
Junio C Hamanof506b8e2010-08-23 10:17:03 -0700273#define DIFF_PICKAXE_KIND_S 4 /* traditional plumbing counter */
274#define DIFF_PICKAXE_KIND_G 8 /* grep in the patch */
275
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700276extern void diffcore_std(struct diff_options *);
Junio C Hamano730f7282009-09-20 00:03:39 -0700277extern void diffcore_fix_diff_index(struct diff_options *);
Junio C Hamanof2ce9fd2005-06-11 20:57:13 -0700278
Junio C Hamanodda2d792005-07-13 12:52:35 -0700279#define COMMON_DIFF_OPTIONS_HELP \
280"\ncommon diff options:\n" \
Junio C Hamano8082d8d2005-09-21 00:18:27 -0700281" -z output diff-raw with lines terminated with NUL.\n" \
282" -p output patch format.\n" \
283" -u synonym for -p.\n" \
Petr Baudis5c91da22006-04-11 13:22:17 +0200284" --patch-with-raw\n" \
285" output both a patch and the diff-raw format.\n" \
Johannes Schindelind75f7952006-04-14 00:15:30 +0200286" --stat show diffstat instead of patch.\n" \
Junio C Hamano74e2abe2006-10-12 03:01:00 -0700287" --numstat show numeric diffstat instead of patch.\n" \
Johannes Schindelin29353272006-04-15 13:41:18 +0200288" --patch-with-stat\n" \
289" output a patch and prepend its diffstat.\n" \
Junio C Hamano8082d8d2005-09-21 00:18:27 -0700290" --name-only show only names of changed files.\n" \
Junio C Hamano946f5f72005-09-21 00:20:06 -0700291" --name-status show names and status of changed files.\n" \
Junio C Hamano47dd0d52005-12-13 17:21:41 -0800292" --full-index show full object name on index lines.\n" \
Junio C Hamano913419f2005-12-18 02:03:15 -0800293" --abbrev=<n> abbreviate object names in diff-tree header and diff-raw.\n" \
Junio C Hamano8082d8d2005-09-21 00:18:27 -0700294" -R swap input file pairs.\n" \
295" -B detect complete rewrites.\n" \
296" -M detect renames.\n" \
297" -C detect copies.\n" \
Junio C Hamanodda2d792005-07-13 12:52:35 -0700298" --find-copies-harder\n" \
Junio C Hamano8082d8d2005-09-21 00:18:27 -0700299" try unchanged files as candidate for copy detection.\n" \
300" -l<n> limit rename attempts up to <n> paths.\n" \
301" -O<file> reorder diffs according to the <file>.\n" \
302" -S<string> find filepair whose only one side contains the string.\n" \
Junio C Hamanodda2d792005-07-13 12:52:35 -0700303" --pickaxe-all\n" \
Stephan Federca499202006-07-07 15:57:08 +0200304" show all files diff when -S is used and hit is found.\n" \
305" -a --text treat all files as text.\n"
Junio C Hamanodda2d792005-07-13 12:52:35 -0700306
Junio C Hamano38c6f782005-05-21 19:40:36 -0700307extern int diff_queue_is_empty(void);
Junio C Hamano6b5ee132005-09-21 00:00:47 -0700308extern void diff_flush(struct diff_options*);
Junio C Hamanof31027c2011-01-06 13:50:06 -0800309extern void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc);
Junio C Hamano86436c22005-04-25 18:22:47 -0700310
Junio C Hamanoe7baa4f2005-07-25 13:05:44 -0700311/* diff-raw status letters */
Junio C Hamanoca8c9152005-07-25 14:31:19 -0700312#define DIFF_STATUS_ADDED 'A'
Junio C Hamanoe7baa4f2005-07-25 13:05:44 -0700313#define DIFF_STATUS_COPIED 'C'
314#define DIFF_STATUS_DELETED 'D'
315#define DIFF_STATUS_MODIFIED 'M'
316#define DIFF_STATUS_RENAMED 'R'
317#define DIFF_STATUS_TYPE_CHANGED 'T'
318#define DIFF_STATUS_UNKNOWN 'X'
319#define DIFF_STATUS_UNMERGED 'U'
320
321/* these are not diff-raw status letters proper, but used by
322 * diffcore-filter insn to specify additional restrictions.
323 */
Junio C Hamano0b343792005-10-04 17:44:17 -0700324#define DIFF_STATUS_FILTER_AON '*'
Junio C Hamanoe7baa4f2005-07-25 13:05:44 -0700325#define DIFF_STATUS_FILTER_BROKEN 'B'
326
Junio C Hamano47dd0d52005-12-13 17:21:41 -0800327extern const char *diff_unique_abbrev(const unsigned char *, int);
328
Junio C Hamano4bd5b7d2007-11-10 00:15:03 -0800329/* do not report anything on removed paths */
330#define DIFF_SILENT_ON_REMOVED 01
Junio C Hamanofb63d7f2007-11-09 18:22:52 -0800331/* report racily-clean paths as modified */
332#define DIFF_RACY_IS_MODIFIED 02
Junio C Hamano4bd5b7d2007-11-10 00:15:03 -0800333extern int run_diff_files(struct rev_info *revs, unsigned int option);
Junio C Hamano5c21ac02006-04-22 03:58:04 -0700334extern int run_diff_index(struct rev_info *revs, int cached);
Junio C Hamanoe09ad6e2006-04-22 02:43:00 -0700335
Junio C Hamano1cfe7732007-01-30 01:11:08 -0800336extern int do_diff_cache(const unsigned char *, struct diff_options *);
Johannes Schindelinfcb3d0a2006-06-25 03:51:08 +0200337extern int diff_flush_patch_id(struct diff_options *, unsigned char *);
338
Junio C Hamanoda31b352007-12-13 23:40:27 -0800339extern int diff_result_code(struct diff_options *, int);
340
Thomas Gummerer470faf92013-12-11 10:58:42 +0100341extern void diff_no_index(struct rev_info *, int, const char **, const char *);
Junio C Hamano0569e9b2008-05-23 22:28:56 -0700342
Stephan Beyer75f3ff22009-02-10 15:30:35 +0100343extern int index_differs_from(const char *def, int diff_flags);
344
Axel Bonneta788d7d2010-06-07 17:23:36 +0200345extern size_t fill_textconv(struct userdiff_driver *driver,
346 struct diff_filespec *df,
347 char **outbuf);
348
349extern struct userdiff_driver *get_textconv(struct diff_filespec *one);
350
Kevin Ballard10ae7522010-09-27 16:58:25 -0700351extern int parse_rename_score(const char **cp_p);
352
Michal Privoznik07924d42013-01-16 08:51:58 +0100353extern long parse_algorithm_value(const char *value);
354
Nguyễn Thái Ngọc Duy7f814632012-02-01 19:55:07 +0700355extern int print_stat_summary(FILE *fp, int files,
356 int insertions, int deletions);
Nguyễn Thái Ngọc Duy4914c962012-10-26 22:53:52 +0700357extern void setup_diff_pager(struct diff_options *);
Nguyễn Thái Ngọc Duy7f814632012-02-01 19:55:07 +0700358
Junio C Hamano86436c22005-04-25 18:22:47 -0700359#endif /* DIFF_H */