diff options
author | Taylor Blau <me@ttaylorr.com> | 2022-05-21 01:17:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-05-27 00:48:26 +0200 |
commit | 5dfaf49a5a651d3e8c3552bc2e833312a3671a4f (patch) | |
tree | f87f12552c923b46de589e26a70e7fc67502aed7 /pack-objects.c | |
parent | chunk-format.h: extract oid_version() (diff) | |
download | git-5dfaf49a5a651d3e8c3552bc2e833312a3671a4f.tar.xz git-5dfaf49a5a651d3e8c3552bc2e833312a3671a4f.zip |
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>
Diffstat (limited to 'pack-objects.c')
-rw-r--r-- | pack-objects.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pack-objects.c b/pack-objects.c index fe2a4eace9..272e8d4517 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -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; } |