diff options
author | Lars Schneider <larsxschneider@gmail.com> | 2017-06-30 22:41:28 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-30 22:50:41 +0200 |
commit | 2841e8f81cb2820024804b9341577be1d0ce1240 (patch) | |
tree | 21a9a9a8528b07bbd516ff1384156a20ea5f8464 /convert.h | |
parent | convert: refactor capabilities negotiation (diff) | |
download | git-2841e8f81cb2820024804b9341577be1d0ce1240.tar.xz git-2841e8f81cb2820024804b9341577be1d0ce1240.zip |
convert: add "status=delayed" to filter process protocol
Some `clean` / `smudge` filters may require a significant amount of
time to process a single blob (e.g. the Git LFS smudge filter might
perform network requests). During this process the Git checkout
operation is blocked and Git needs to wait until the filter is done to
continue with the checkout.
Teach the filter process protocol, introduced in edcc8581 ("convert: add
filter.<driver>.process option", 2016-10-16), to accept the status
"delayed" as response to a filter request. Upon this response Git
continues with the checkout operation. After the checkout operation Git
calls "finish_delayed_checkout" which queries the filter for remaining
blobs. If the filter is still working on the completion, then the filter
is expected to block. If the filter has completed all remaining blobs
then an empty response is expected.
Git has a multiple code paths that checkout a blob. Support delayed
checkouts only in `clone` (in unpack-trees.c) and `checkout` operations
for now. The optimization is most effective in these code paths as all
files of the tree are processed.
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.h')
-rw-r--r-- | convert.h | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -4,6 +4,8 @@ #ifndef CONVERT_H #define CONVERT_H +#include "string-list.h" + enum safe_crlf { SAFE_CRLF_FALSE = 0, SAFE_CRLF_FAIL = 1, @@ -32,6 +34,26 @@ 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_wt_convert_stats_ascii(const char *path); @@ -42,6 +64,10 @@ extern int convert_to_git(const char *path, const char *src, size_t len, 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, struct strbuf *dst); static inline int would_convert_to_git(const char *path) |