aboutsummaryrefslogtreecommitdiff
path: root/pack-objects.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-06-03 14:30:37 -0700
committerJunio C Hamano <gitster@pobox.com>2022-06-03 14:30:37 -0700
commita50036da1a39806a8ae1aba2e2f2fea6f7fb8e08 (patch)
tree1e6c184852ee5a5e5860073c04ea73e034b0060f /pack-objects.h
parent37d4ae58efcc9f716435f327c39d5552aedb4b7c (diff)
parenta613164257b46700ca583bdcab160c712ad392fe (diff)
downloadgit-a50036da1a39806a8ae1aba2e2f2fea6f7fb8e08.tar.xz
Merge branch 'tb/cruft-packs'
A mechanism to pack unreachable objects into a "cruft pack", instead of ejecting them into loose form to be reclaimed later, has been introduced. * tb/cruft-packs: sha1-file.c: don't freshen cruft packs builtin/gc.c: conditionally avoid pruning objects via loose builtin/repack.c: add cruft packs to MIDX during geometric repack builtin/repack.c: use named flags for existing_packs builtin/repack.c: allow configuring cruft pack generation builtin/repack.c: support generating a cruft pack builtin/pack-objects.c: --cruft with expiration reachable: report precise timestamps from objects in cruft packs reachable: add options to add_unseen_recent_objects_to_traversal builtin/pack-objects.c: --cruft without expiration builtin/pack-objects.c: return from create_object_entry() t/helper: add 'pack-mtimes' test-tool pack-mtimes: support writing pack .mtimes files chunk-format.h: extract oid_version() pack-write: pass 'struct packing_data' to 'stage_tmp_packfiles' pack-mtimes: support reading .mtimes files Documentation/technical: add cruft-packs.txt
Diffstat (limited to 'pack-objects.h')
-rw-r--r--pack-objects.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/pack-objects.h b/pack-objects.h
index dca2351ef9..393b9db546 100644
--- a/pack-objects.h
+++ b/pack-objects.h
@@ -168,6 +168,14 @@ struct packing_data {
/* delta islands */
unsigned int *tree_depth;
unsigned char *layer;
+
+ /*
+ * Used when writing cruft packs.
+ *
+ * Object mtimes are stored in pack order when writing, but
+ * written out in lexicographic (index) order.
+ */
+ uint32_t *cruft_mtime;
};
void prepare_packing_data(struct repository *r, struct packing_data *pdata);
@@ -289,4 +297,21 @@ static inline void oe_set_layer(struct packing_data *pack,
pack->layer[e - pack->objects] = layer;
}
+static inline uint32_t oe_cruft_mtime(struct packing_data *pack,
+ struct object_entry *e)
+{
+ if (!pack->cruft_mtime)
+ return 0;
+ return pack->cruft_mtime[e - pack->objects];
+}
+
+static inline void oe_set_cruft_mtime(struct packing_data *pack,
+ struct object_entry *e,
+ uint32_t mtime)
+{
+ if (!pack->cruft_mtime)
+ CALLOC_ARRAY(pack->cruft_mtime, pack->nr_alloc);
+ pack->cruft_mtime[e - pack->objects] = mtime;
+}
+
#endif