]> git.ipfire.org Git - thirdparty/git.git/blob - userdiff.h
post-cocci: adjust comments for recent repo_* migration
[thirdparty/git.git] / userdiff.h
1 #ifndef USERDIFF_H
2 #define USERDIFF_H
3
4 #include "notes-cache.h"
5
6 struct index_state;
7 struct repository;
8
9 struct userdiff_funcname {
10 const char *pattern;
11 int cflags;
12 };
13
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 *textconv;
22 struct notes_cache *textconv_cache;
23 int textconv_want_cache;
24 };
25 enum userdiff_driver_type {
26 USERDIFF_DRIVER_TYPE_BUILTIN = 1<<0,
27 USERDIFF_DRIVER_TYPE_CUSTOM = 1<<1,
28 };
29 typedef int (*each_userdiff_driver_fn)(struct userdiff_driver *,
30 enum userdiff_driver_type, void *);
31
32 int userdiff_config(const char *k, const char *v);
33 struct userdiff_driver *userdiff_find_by_name(const char *name);
34 struct userdiff_driver *userdiff_find_by_path(struct index_state *istate,
35 const char *path);
36
37 /*
38 * Initialize any textconv-related fields in the driver and return it, or NULL
39 * if it does not have textconv enabled at all.
40 */
41 struct userdiff_driver *userdiff_get_textconv(struct repository *r,
42 struct userdiff_driver *driver);
43
44 /*
45 * Iterate over all userdiff drivers. The userdiff_driver_type
46 * argument to each_userdiff_driver_fn indicates their type. Return
47 * non-zero to exit early from the loop.
48 */
49 int for_each_userdiff_driver(each_userdiff_driver_fn, void *);
50
51 #endif /* USERDIFF */