On Wed, Nov 4, 2020 at 9:34 PM Matheus Tavares <matheus.bernardino@xxxxxx> wrote: > + if (topath) { > + if (S_ISREG(ce->ce_mode)) { > + convert_attrs(state->istate, &ca_buf, ce->name); > + ca = &ca_buf; > + } > + return write_entry(ce, topath, ca, state, 1); We pass `ca` here instead of `&ca_buf` because ca is NULL if we are not dealing with a regular file. Ok, I think it's indeed better to pass NULL in this case. > @@ -517,9 +526,16 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, > return 0; > > create_directories(path.buf, path.len, state); > + > if (nr_checkouts) > (*nr_checkouts)++; > - return write_entry(ce, path.buf, state, 0); > + > + if (S_ISREG(ce->ce_mode)) { > + convert_attrs(state->istate, &ca_buf, ce->name); > + ca = &ca_buf; > + } > + > + return write_entry(ce, path.buf, NULL, state, 0); I am not sure why NULL is passed here though instead of `ca`. The following comment is added in front of write_entry(): +/* Note: ca is used (and required) iff the entry refers to a regular file. */ So I would think that `ca` should be passed.