diff options
author | Matheus Tavares <matheus.bernardino@usp.br> | 2021-03-23 15:19:36 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-23 18:34:05 +0100 |
commit | ae22751f9b4bbbebcd0366a48a118b5a575af72d (patch) | |
tree | 9af8f86811ebfa5d864e4967048fe890897b2d69 /entry.c | |
parent | entry: move conv_attrs lookup up to checkout_entry() (diff) | |
download | git-ae22751f9b4bbbebcd0366a48a118b5a575af72d.tar.xz git-ae22751f9b4bbbebcd0366a48a118b5a575af72d.zip |
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.c')
-rw-r--r-- | entry.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -440,12 +440,13 @@ static void mark_colliding_entries(const struct checkout *state, } } -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 struct strbuf path = STRBUF_INIT; struct stat st; - struct conv_attrs ca_buf, *ca = NULL; + struct conv_attrs ca_buf; if (ce->ce_flags & CE_WT_REMOVE) { if (topath) @@ -459,7 +460,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, } if (topath) { - if (S_ISREG(ce->ce_mode)) { + if (S_ISREG(ce->ce_mode) && !ca) { convert_attrs(state->istate, &ca_buf, ce->name); ca = &ca_buf; } @@ -530,7 +531,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, if (nr_checkouts) (*nr_checkouts)++; - if (S_ISREG(ce->ce_mode)) { + if (S_ISREG(ce->ce_mode) && !ca) { convert_attrs(state->istate, &ca_buf, ce->name); ca = &ca_buf; } |