X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=userdiff.c;h=01d3a8b81e628b0a088e3e9fc0ca59acf7d9c58d;hb=c0b13b21b8daa4bfb222e9c4d335c8b340c511a0;hp=e55310cd02c8e7d1f0404b2fee9539e7340993d9;hpb=efd02e92c9961063bae63da7f7446868a38f14ce;p=git.git diff --git a/userdiff.c b/userdiff.c index e55310cd0..01d3a8b81 100644 --- a/userdiff.c +++ b/userdiff.c @@ -281,3 +281,20 @@ struct userdiff_driver *userdiff_find_by_path(const char *path) return NULL; return userdiff_find_by_name(check.value); } + +struct userdiff_driver *userdiff_get_textconv(struct userdiff_driver *driver) +{ + if (!driver->textconv) + return NULL; + + if (driver->textconv_want_cache && !driver->textconv_cache) { + struct notes_cache *c = xmalloc(sizeof(*c)); + struct strbuf name = STRBUF_INIT; + + strbuf_addf(&name, "textconv/%s", driver->name); + notes_cache_init(c, name.buf, driver->textconv); + driver->textconv_cache = c; + } + + return driver; +}