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:
Taylor Blau
2022-05-20 19:17:43 -04:00
committed by Junio C Hamano
parent d9fef9d90d
commit 5dfaf49a5a
4 changed files with 109 additions and 0 deletions

View File

@ -170,6 +170,9 @@ struct object_entry *packlist_alloc(struct packing_data *pdata,
if (pdata->layer)
REALLOC_ARRAY(pdata->layer, pdata->nr_alloc);
if (pdata->cruft_mtime)
REALLOC_ARRAY(pdata->cruft_mtime, pdata->nr_alloc);
}
new_entry = pdata->objects + pdata->nr_objects++;
@ -198,6 +201,9 @@ struct object_entry *packlist_alloc(struct packing_data *pdata,
if (pdata->layer)
pdata->layer[pdata->nr_objects - 1] = 0;
if (pdata->cruft_mtime)
pdata->cruft_mtime[pdata->nr_objects - 1] = 0;
return new_entry;
}