V2 changes: I lost a couple changes in the shuffle while splitting these changes out * Make the will-destroy boolean a single bit field of type unsigned int so that it doesn't change twice in this small patch series. * Remove a the_repository reference in the disable ref updates code. Now the repository is taken from the ref_store. New interface into the tmp-objdir API to help in-core use of the quarantine feature. This patch series was formerly part of the ns/batched-fsync topic [1]. It's now split out into its own gitgitgadget PR and discussion thread since it is the base for en/remerge-diff as well. The most recent feedback was in [2]. I removed printing from prune_subdir and simplified the strbuf handling in prune_tmp_file. References: [1] https://lore.kernel.org/git/pull.1076.v9.git.git.1637020263.gitgitgadget@xxxxxxxxx/ [2] https://lore.kernel.org/git/CABPp-BH6m4q_EoX77bqLcpCN1HRfJ_XayeCV2O0sRybX53rPrw@xxxxxxxxxxxxxx/ Neeraj Singh (2): tmp-objdir: new API for creating temporary writable databases tmp-objdir: disable ref updates when replacing the primary odb builtin/prune.c | 20 ++++++++++++--- builtin/receive-pack.c | 2 +- environment.c | 9 +++++++ object-file.c | 50 ++++++++++++++++++++++++++++++++++++-- object-store.h | 26 ++++++++++++++++++++ object.c | 2 +- refs.c | 2 +- repository.c | 2 ++ repository.h | 1 + tmp-objdir.c | 55 +++++++++++++++++++++++++++++++++++++++--- tmp-objdir.h | 29 +++++++++++++++++++--- 11 files changed, 183 insertions(+), 15 deletions(-) base-commit: cd3e606211bb1cf8bc57f7d76bab98cc17a150bc Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1091%2Fneerajsi-msft%2Fns%2Ftmp-objdir-v2 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1091/neerajsi-msft/ns/tmp-objdir-v2 Pull-Request: https://github.com/gitgitgadget/git/pull/1091 Range-diff vs v1: 1: 4ae4303595e ! 1: 36c00613d9a tmp-objdir: new API for creating temporary writable databases @@ object-store.h: struct object_directory { + /* + * This object store is ephemeral, so there is no need to fsync. + */ -+ int will_destroy; ++ unsigned int will_destroy : 1; + /* * Path to the alternative object store. If this is a relative path, 2: d8ae001500c ! 2: f667cbcc47d tmp-objdir: disable ref updates when replacing the primary odb @@ object-store.h: struct object_directory { /* * This object store is ephemeral, so there is no need to fsync. */ -- int will_destroy; -+ unsigned int will_destroy : 1; - - /* - * Path to the alternative object store. If this is a relative path, ## refs.c ## @@ refs.c: int ref_transaction_prepare(struct ref_transaction *transaction, @@ refs.c: int ref_transaction_prepare(struct ref_transaction *transaction, } - if (getenv(GIT_QUARANTINE_ENVIRONMENT)) { -+ if (the_repository->objects->odb->disable_ref_updates) { ++ if (refs->repo->objects->odb->disable_ref_updates) { strbuf_addstr(err, _("ref updates forbidden inside quarantine environment")); return -1; -- gitgitgadget