Re: [PATCH v4 07/19] entry: extract cache_entry update from write_entry()
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Dec 6, 2020, 08:53 UTC
- Message-ID
- <CAP8UFD1w7Sgh5KYApHy034mRA7Ls47Wb9kcecyeQM6vYcH-acA@mail.gmail.com>
- In-Reply-To
- <a0479d02ffedccb65a167463228445a6d62c9f96.1604521275.git.matheus.bernardino@usp.br>
On Wed, Nov 4, 2020 at 9:33 PM Matheus Tavares <matheus.bernardino@usp.br> wrote:
> > This code will be used by the parallel checkout functions, outside > entry.c, so extract it to a public function.
Maybe the title could be a bit more explicit like: "entry: extract update_ce_after_write() from write_entry()"
And: s/This code/This new function/
> @@ -371,15 +383,10 @@ static int write_entry(struct cache_entry *ce,
>
> finish:
> if (state->refresh_cache) {Here we check state->refresh_cache ...
Show 13 quoted lines
> - assert(state->istate);
> - if (!fstat_done)
> - if (lstat(ce->name, &st) < 0)
> - return error_errno("unable to stat just-written file %s",
> - ce->name);
> - fill_stat_cache_info(state->istate, ce, &st);
> - ce->ce_flags |= CE_UPDATE_IN_BASE;
> - mark_fsmonitor_invalid(state->istate, ce);
> - state->istate->cache_changed |= CE_ENTRY_CHANGED;
> + if (!fstat_done && lstat(ce->name, &st) < 0)
> + return error_errno("unable to stat just-written file %s",
> + ce->name);
> + update_ce_after_write(state, ce , &st);... and inside update_ce_after_write() we check state->refresh_cache again. So the check is now done twice.
Not a big issue though.