Post 2.46-rc0 batch #1
[git.git] / userdiff.h
blob7565930337cf5546e8b316d3725e630917f8f7d1
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 external_diff {
15 char *cmd;
16 unsigned trust_exit_code:1;
19 struct userdiff_driver {
20 const char *name;
21 struct external_diff external;
22 const char *algorithm;
23 int binary;
24 struct userdiff_funcname funcname;
25 const char *word_regex;
26 const char *word_regex_multi_byte;
27 const char *textconv;
28 struct notes_cache *textconv_cache;
29 int textconv_want_cache;
31 enum userdiff_driver_type {
32 USERDIFF_DRIVER_TYPE_BUILTIN = 1<<0,
33 USERDIFF_DRIVER_TYPE_CUSTOM = 1<<1,
35 typedef int (*each_userdiff_driver_fn)(struct userdiff_driver *,
36 enum userdiff_driver_type, void *);
38 int userdiff_config(const char *k, const char *v);
39 struct userdiff_driver *userdiff_find_by_name(const char *name);
40 struct userdiff_driver *userdiff_find_by_path(struct index_state *istate,
41 const char *path);
44 * Initialize any textconv-related fields in the driver and return it, or NULL
45 * if it does not have textconv enabled at all.
47 struct userdiff_driver *userdiff_get_textconv(struct repository *r,
48 struct userdiff_driver *driver);
51 * Iterate over all userdiff drivers. The userdiff_driver_type
52 * argument to each_userdiff_driver_fn indicates their type. Return
53 * non-zero to exit early from the loop.
55 int for_each_userdiff_driver(each_userdiff_driver_fn, void *);
57 #endif /* USERDIFF */