object-file: lift ODB reprepare out of packfile flush
When flushing a packfile via `flush_packfile_transaction()`, `odb_reprepare()` is invoked so the written packfile becomes visible in the current process. In a subsequent commit, repreparing the ODB is slightly deferred when committing a "files" ODB transaction. Lift ODB reprepare out of `flush_packfile_transaction()` and instead require callers to explicitly invoke `odb_reprepare()` if required. Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>seen
parent
47ce80527c
commit
dae07bd6c8
|
|
@ -857,8 +857,6 @@ clear_exit:
|
|||
memset(state, 0, sizeof(*state));
|
||||
|
||||
strbuf_release(&packname);
|
||||
/* Make objects we just wrote available to ourselves */
|
||||
odb_reprepare(repo->objects);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -909,8 +907,10 @@ static int odb_transaction_files_write_object_stream(struct odb_transaction *bas
|
|||
* to zlib compression and is sufficient for this check.
|
||||
*/
|
||||
if (state->nr_written && pack_size_limit_cfg &&
|
||||
pack_size_limit_cfg < state->offset + stream->size)
|
||||
pack_size_limit_cfg < state->offset + stream->size) {
|
||||
flush_packfile_transaction(transaction);
|
||||
odb_reprepare(transaction->base.source->odb);
|
||||
}
|
||||
|
||||
CALLOC_ARRAY(idx, 1);
|
||||
prepare_packfile_transaction(transaction);
|
||||
|
|
@ -1260,6 +1260,7 @@ static int odb_transaction_files_commit(struct odb_transaction *base)
|
|||
{
|
||||
struct odb_transaction_files *transaction =
|
||||
container_of(base, struct odb_transaction_files, base);
|
||||
int have_packfile = !!transaction->packfile.f;
|
||||
|
||||
if (transaction->objdir) {
|
||||
struct strbuf temp_path = STRBUF_INIT;
|
||||
|
|
@ -1293,6 +1294,9 @@ static int odb_transaction_files_commit(struct odb_transaction *base)
|
|||
|
||||
flush_packfile_transaction(transaction);
|
||||
|
||||
if (have_packfile)
|
||||
odb_reprepare(transaction->base.source->odb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue