Merge branch 'rs/archive-with-attr-pathspec-fix'
[git/gitster.git] / userdiff.h
blob827361b0bc9569426ba35d5b47b066464d1b7b92
1 #ifndef USERDIFF_H
2 #define USERDIFF_H
4 #include "notes-cache.h"
6 struct index_state;
7 struct repository;
9 struct userdiff_funcname {
10 const char *pattern;
11 char *pattern_owned;
12 int cflags;
15 struct external_diff {
16 char *cmd;
17 unsigned trust_exit_code:1;
20 struct userdiff_driver {
21 const char *name;
22 struct external_diff external;
23 const char *algorithm;
24 char *algorithm_owned;
25 int binary;
26 struct userdiff_funcname funcname;
27 const char *word_regex;
28 char *word_regex_owned;
29 const char *word_regex_multi_byte;
30 const char *textconv;
31 char *textconv_owned;
32 struct notes_cache *textconv_cache;
33 int textconv_want_cache;
35 enum userdiff_driver_type {
36 USERDIFF_DRIVER_TYPE_BUILTIN = 1<<0,
37 USERDIFF_DRIVER_TYPE_CUSTOM = 1<<1,
39 typedef int (*each_userdiff_driver_fn)(struct userdiff_driver *,
40 enum userdiff_driver_type, void *);
42 int userdiff_config(const char *k, const char *v);
43 struct userdiff_driver *userdiff_find_by_name(const char *name);
44 struct userdiff_driver *userdiff_find_by_path(struct index_state *istate,
45 const char *path);
48 * Initialize any textconv-related fields in the driver and return it, or NULL
49 * if it does not have textconv enabled at all.
51 struct userdiff_driver *userdiff_get_textconv(struct repository *r,
52 struct userdiff_driver *driver);
55 * Iterate over all userdiff drivers. The userdiff_driver_type
56 * argument to each_userdiff_driver_fn indicates their type. Return
57 * non-zero to exit early from the loop.
59 int for_each_userdiff_driver(each_userdiff_driver_fn, void *);
61 #endif /* USERDIFF */