mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
pack-mtimes: support writing pack .mtimes files
Now that the `.mtimes` format is defined, supplement the pack-write API to be able to conditionally write an `.mtimes` file along with a pack by setting an additional flag and passing an oidmap that contains the timestamps corresponding to each object in the pack. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
d9fef9d90d
commit
5dfaf49a5a
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user