Git fork
at reftables-rust 61 lines 1.6 kB view raw
1#ifndef USERDIFF_H 2#define USERDIFF_H 3 4#include "notes-cache.h" 5 6struct index_state; 7struct repository; 8 9struct userdiff_funcname { 10 const char *pattern; 11 char *pattern_owned; 12 int cflags; 13}; 14 15struct external_diff { 16 char *cmd; 17 unsigned trust_exit_code:1; 18}; 19 20struct 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; 34}; 35enum userdiff_driver_type { 36 USERDIFF_DRIVER_TYPE_BUILTIN = 1<<0, 37 USERDIFF_DRIVER_TYPE_CUSTOM = 1<<1, 38}; 39typedef int (*each_userdiff_driver_fn)(struct userdiff_driver *, 40 enum userdiff_driver_type, void *); 41 42int userdiff_config(const char *k, const char *v); 43struct userdiff_driver *userdiff_find_by_name(const char *name); 44struct userdiff_driver *userdiff_find_by_path(struct index_state *istate, 45 const char *path); 46 47/* 48 * Initialize any textconv-related fields in the driver and return it, or NULL 49 * if it does not have textconv enabled at all. 50 */ 51struct userdiff_driver *userdiff_get_textconv(struct repository *r, 52 struct userdiff_driver *driver); 53 54/* 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. 58 */ 59int for_each_userdiff_driver(each_userdiff_driver_fn, void *); 60 61#endif /* USERDIFF */