diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-04-02 14:43:14 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-04-02 14:43:14 -0700 |
commit | c47679d0405f134703fcae0f8f0b7ef82ecf96d5 (patch) | |
tree | 2de6886f318b23dbbbfe9d3a68f6d6e6d66ee425 /entry.h | |
parent | The fifth batch (diff) | |
parent | entry: add checkout_entry_ca() taking preloaded conv_attrs (diff) | |
download | tgif-c47679d0405f134703fcae0f8f0b7ef82ecf96d5.tar.xz |
Merge branch 'mt/parallel-checkout-part-1'
Preparatory API changes for parallel checkout.
* mt/parallel-checkout-part-1:
entry: add checkout_entry_ca() taking preloaded conv_attrs
entry: move conv_attrs lookup up to checkout_entry()
entry: extract update_ce_after_write() from write_entry()
entry: make fstat_output() and read_blob_entry() public
entry: extract a header file for entry.c functions
convert: add classification for conv_attrs struct
convert: add get_stream_filter_ca() variant
convert: add [async_]convert_to_working_tree_ca() variants
convert: make convert_attrs() and convert structs public
Diffstat (limited to 'entry.h')
-rw-r--r-- | entry.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/entry.h b/entry.h new file mode 100644 index 0000000000..b8c0e170dc --- /dev/null +++ b/entry.h @@ -0,0 +1,59 @@ +#ifndef ENTRY_H +#define ENTRY_H + +#include "cache.h" +#include "convert.h" + +struct checkout { + struct index_state *istate; + const char *base_dir; + int base_dir_len; + struct delayed_checkout *delayed_checkout; + struct checkout_metadata meta; + unsigned force:1, + quiet:1, + not_new:1, + clone:1, + refresh_cache:1; +}; +#define CHECKOUT_INIT { NULL, "" } + +#define TEMPORARY_FILENAME_LENGTH 25 +/* + * Write the contents from ce out to the working tree. + * + * When topath[] is not NULL, instead of writing to the working tree + * file named by ce, a temporary file is created by this function and + * its name is returned in topath[], which must be able to hold at + * least TEMPORARY_FILENAME_LENGTH bytes long. + * + * With checkout_entry_ca(), callers can optionally pass a preloaded + * conv_attrs struct (to avoid reloading it), when ce refers to a + * regular file. If ca is NULL, the attributes will be loaded + * internally when (and if) needed. + */ +int checkout_entry_ca(struct cache_entry *ce, struct conv_attrs *ca, + const struct checkout *state, char *topath, + int *nr_checkouts); +static inline int checkout_entry(struct cache_entry *ce, + const struct checkout *state, char *topath, + int *nr_checkouts) +{ + return checkout_entry_ca(ce, NULL, state, topath, nr_checkouts); +} + +void enable_delayed_checkout(struct checkout *state); +int finish_delayed_checkout(struct checkout *state, int *nr_checkouts); + +/* + * Unlink the last component and schedule the leading directories for + * removal, such that empty directories get removed. + */ +void unlink_entry(const struct cache_entry *ce); + +void *read_blob_entry(const struct cache_entry *ce, unsigned long *size); +int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st); +void update_ce_after_write(const struct checkout *state, struct cache_entry *ce, + struct stat *st); + +#endif /* ENTRY_H */ |