Merge branch 'jc/format-patch-rfc-more'
[git/gitster.git] / userdiff.h
blobd726804c3e5ee8879ff41d5a424569f9e1b10e3d
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 int cflags;
14 struct userdiff_driver {
15 const char *name;
16 const char *external;
17 const char *algorithm;
18 int binary;
19 struct userdiff_funcname funcname;
20 const char *word_regex;
21 const char *word_regex_multi_byte;
22 const char *textconv;
23 struct notes_cache *textconv_cache;
24 int textconv_want_cache;
26 enum userdiff_driver_type {
27 USERDIFF_DRIVER_TYPE_BUILTIN = 1<<0,
28 USERDIFF_DRIVER_TYPE_CUSTOM = 1<<1,
30 typedef int (*each_userdiff_driver_fn)(struct userdiff_driver *,
31 enum userdiff_driver_type, void *);
33 int userdiff_config(const char *k, const char *v);
34 struct userdiff_driver *userdiff_find_by_name(const char *name);
35 struct userdiff_driver *userdiff_find_by_path(struct index_state *istate,
36 const char *path);
39 * Initialize any textconv-related fields in the driver and return it, or NULL
40 * if it does not have textconv enabled at all.
42 struct userdiff_driver *userdiff_get_textconv(struct repository *r,
43 struct userdiff_driver *driver);
46 * Iterate over all userdiff drivers. The userdiff_driver_type
47 * argument to each_userdiff_driver_fn indicates their type. Return
48 * non-zero to exit early from the loop.
50 int for_each_userdiff_driver(each_userdiff_driver_fn, void *);
52 #endif /* USERDIFF */