]> git.ipfire.org Git - thirdparty/git.git/commit - environment.c
tmp-objdir: new API for creating temporary writable databases
authorNeeraj Singh <neerajsi@microsoft.com>
Mon, 6 Dec 2021 22:05:04 +0000 (22:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Dec 2021 22:06:36 +0000 (14:06 -0800)
commitb3cecf49eac00d62e361bf6e6e81392f5a2fb571
treeae4937eebd6d08bb828dd1967d043369c496c945
parentcefe983a320c03d7843ac78e73bd513a27806845
tmp-objdir: new API for creating temporary writable databases

The tmp_objdir API provides the ability to create temporary object
directories, but was designed with the goal of having subprocesses
access these object stores, followed by the main process migrating
objects from it to the main object store or just deleting it.  The
subprocesses would view it as their primary datastore and write to it.

Here we add the tmp_objdir_replace_primary_odb function that replaces
the current process's writable "main" object directory with the
specified one. The previous main object directory is restored in either
tmp_objdir_migrate or tmp_objdir_destroy.

For the --remerge-diff usecase, add a new `will_destroy` flag in `struct
object_database` to mark ephemeral object databases that do not require
fsync durability.

Add 'git prune' support for removing temporary object databases, and
make sure that they have a name starting with tmp_ and containing an
operation-specific name.

Based-on-patch-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/prune.c
builtin/receive-pack.c
environment.c
object-file.c
object-store.h
object.c
tmp-objdir.c
tmp-objdir.h