From: Junio C Hamano Date: Fri, 11 Aug 2017 20:27:00 +0000 (-0700) Subject: Merge branch 'ls/filter-process-delayed' X-Git-Tag: v2.15.0-rc0~200 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=51b8aecabed1363f13c990320a50e1fb2aa3f696;p=thirdparty%2Fgit.git Merge branch 'ls/filter-process-delayed' The filter-process interface learned to allow a process with long latency give a "delayed" response. * ls/filter-process-delayed: convert: add "status=delayed" to filter process protocol convert: refactor capabilities negotiation convert: move multiple file filter error handling to separate function convert: put the flags field before the flag itself for consistent style t0021: write "OUT " only on success t0021: make debug log file name configurable t0021: keep filter log files on comparison --- 51b8aecabed1363f13c990320a50e1fb2aa3f696 diff --cc convert.c index deaf0ba7b3,12a0b3eafb..972bf8aec2 --- a/convert.c +++ b/convert.c @@@ -1122,10 -1204,10 +1212,10 @@@ void convert_to_git_filter_fd(const str assert(ca.drv); assert(ca.drv->clean || ca.drv->process); - if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN)) + if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL)) die("%s: clean filter '%s' failed", path, ca.drv->name); - crlf_to_git(path, dst->buf, dst->len, dst, ca.crlf_action, checksafe); + crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, checksafe); ident_to_git(path, dst->buf, dst->len, dst, ca.ident); } @@@ -1163,15 -1246,21 +1254,22 @@@ static int convert_to_working_tree_inte return ret | ret_filter; } + int async_convert_to_working_tree(const char *path, const char *src, + size_t len, struct strbuf *dst, + void *dco) + { + return convert_to_working_tree_internal(path, src, len, dst, 0, dco); + } + int convert_to_working_tree(const char *path, const char *src, size_t len, struct strbuf *dst) { - return convert_to_working_tree_internal(path, src, len, dst, 0); + return convert_to_working_tree_internal(path, src, len, dst, 0, NULL); } -int renormalize_buffer(const char *path, const char *src, size_t len, struct strbuf *dst) +int renormalize_buffer(const struct index_state *istate, const char *path, + const char *src, size_t len, struct strbuf *dst) { - int ret = convert_to_working_tree_internal(path, src, len, dst, 1); + int ret = convert_to_working_tree_internal(path, src, len, dst, 1, NULL); if (ret) { src = dst->buf; len = dst->len; diff --cc convert.h index cecf59d1aa,643a5be6cc..6b06144281 --- a/convert.h +++ b/convert.h @@@ -4,8 -4,8 +4,10 @@@ #ifndef CONVERT_H #define CONVERT_H + #include "string-list.h" + +struct index_state; + enum safe_crlf { SAFE_CRLF_FALSE = 0, SAFE_CRLF_FAIL = 1, @@@ -34,9 -34,28 +36,29 @@@ enum eol #endif }; + enum ce_delay_state { + CE_NO_DELAY = 0, + CE_CAN_DELAY = 1, + CE_RETRY = 2 + }; + + struct delayed_checkout { + /* + * State of the currently processed cache entry. If the state is + * CE_CAN_DELAY, then the filter can delay the current cache entry. + * If the state is CE_RETRY, then this signals the filter that the + * cache entry was requested before. + */ + enum ce_delay_state state; + /* List of filter drivers that signaled delayed blobs. */ + struct string_list filters; + /* List of delayed blobs identified by their path. */ + struct string_list paths; + }; + extern enum eol core_eol; -extern const char *get_cached_convert_stats_ascii(const char *path); +extern const char *get_cached_convert_stats_ascii(const struct index_state *istate, + const char *path); extern const char *get_wt_convert_stats_ascii(const char *path); extern const char *get_convert_attr_ascii(const char *path); @@@ -46,17 -64,18 +68,21 @@@ extern int convert_to_git(const struct struct strbuf *dst, enum safe_crlf checksafe); extern int convert_to_working_tree(const char *path, const char *src, size_t len, struct strbuf *dst); + extern int async_convert_to_working_tree(const char *path, const char *src, + size_t len, struct strbuf *dst, + void *dco); + extern int async_query_available_blobs(const char *cmd, struct string_list *available_paths); -extern int renormalize_buffer(const char *path, const char *src, size_t len, +extern int renormalize_buffer(const struct index_state *istate, + const char *path, const char *src, size_t len, struct strbuf *dst); -static inline int would_convert_to_git(const char *path) +static inline int would_convert_to_git(const struct index_state *istate, + const char *path) { - return convert_to_git(path, NULL, 0, NULL, 0); + return convert_to_git(istate, path, NULL, 0, NULL, 0); } /* Precondition: would_convert_to_git_filter_fd(path) == true */ -extern void convert_to_git_filter_fd(const char *path, int fd, +extern void convert_to_git_filter_fd(const struct index_state *istate, + const char *path, int fd, struct strbuf *dst, enum safe_crlf checksafe); extern int would_convert_to_git_filter_fd(const char *path);