diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-01-04 03:24:14 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-04 03:24:15 +0300 |
commit | 0dc90d954db852c6604796b8d817365f94e92a16 (patch) | |
tree | 9d4cf45af85370e4e7c89e74ff6ba74b39a28579 /object-store.h | |
parent | 8bb565d375e14ecbd31dee022b8b28e507e38674 (diff) | |
parent | ecd81dfc79cf12cc21fc0340da8ca8fcc5aa58a7 (diff) |
Merge branch 'ns/tmp-objdir'
New interface into the tmp-objdir API to help in-core use of the
quarantine feature.
* ns/tmp-objdir:
tmp-objdir: disable ref updates when replacing the primary odb
tmp-objdir: new API for creating temporary writable databases
Diffstat (limited to 'object-store.h')
-rw-r--r-- | object-store.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/object-store.h b/object-store.h index 952efb6a4b..6f89482df0 100644 --- a/object-store.h +++ b/object-store.h @@ -28,6 +28,18 @@ struct object_directory { struct oidtree *loose_objects_cache; /* + * This is a temporary object store created by the tmp_objdir + * facility. Disable ref updates since the objects in the store + * might be discarded on rollback. + */ + int disable_ref_updates; + + /* + * This object store is ephemeral, so there is no need to fsync. + */ + int will_destroy; + + /* * Path to the alternative object store. If this is a relative path, * it is relative to the current working directory. */ @@ -59,6 +71,17 @@ void add_to_alternates_file(const char *dir); void add_to_alternates_memory(const char *dir); /* + * Replace the current writable object directory with the specified temporary + * object directory; returns the former primary object directory. + */ +struct object_directory *set_temporary_primary_odb(const char *dir, int will_destroy); + +/* + * Restore a previous ODB replaced by set_temporary_main_odb. + */ +void restore_primary_odb(struct object_directory *restore_odb, const char *old_path); + +/* * Populate and return the loose object cache array corresponding to the * given object ID. */ @@ -68,6 +91,9 @@ struct oidtree *odb_loose_cache(struct object_directory *odb, /* Empty the loose object cache for the specified object directory. */ void odb_clear_loose_cache(struct object_directory *odb); +/* Clear and free the specified object directory */ +void free_object_directory(struct object_directory *odb); + struct packed_git { struct hashmap_entry packmap_ent; struct packed_git *next; |