summaryrefslogtreecommitdiff
path: root/entry.h
diff options
context:
space:
mode:
authorMatheus Tavares <matheus.bernardino@usp.br>2021-03-23 14:19:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-23 17:34:05 (GMT)
commitae22751f9b4bbbebcd0366a48a118b5a575af72d (patch)
tree9af8f86811ebfa5d864e4967048fe890897b2d69 /entry.h
parent30419e7e1d53232bb83dcace200d1295b326b22b (diff)
downloadgit-ae22751f9b4bbbebcd0366a48a118b5a575af72d.zip
git-ae22751f9b4bbbebcd0366a48a118b5a575af72d.tar.gz
git-ae22751f9b4bbbebcd0366a48a118b5a575af72d.tar.bz2
entry: add checkout_entry_ca() taking preloaded conv_attrs
The parallel checkout machinery will call checkout_entry() for entries that could not be written in parallel due to path collisions. At this point, we will already be holding the conversion attributes for each entry, and it would be wasteful to let checkout_entry() load these again. Instead, let's add the checkout_entry_ca() variant, which optionally takes a preloaded conv_attrs struct. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'entry.h')
-rw-r--r--entry.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/entry.h b/entry.h
index ea7290b..b8c0e17 100644
--- a/entry.h
+++ b/entry.h
@@ -26,9 +26,21 @@ struct checkout {
* 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(struct cache_entry *ce, const struct checkout *state,
- char *topath, int *nr_checkouts);
+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);