diff options
author | Taylor Blau <me@ttaylorr.com> | 2022-05-21 01:17:35 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-05-27 00:48:26 +0200 |
commit | 94cd775a6c52a99caeb1278c3d8044ee109e2d3e (patch) | |
tree | 82356eb7d022d44f0bc0a290f3ffc2685fdcebb2 /pack-mtimes.h | |
parent | Documentation/technical: add cruft-packs.txt (diff) | |
download | git-94cd775a6c52a99caeb1278c3d8044ee109e2d3e.tar.xz git-94cd775a6c52a99caeb1278c3d8044ee109e2d3e.zip |
pack-mtimes: support reading .mtimes files
To store the individual mtimes of objects in a cruft pack, introduce a
new `.mtimes` format that can optionally accompany a single pack in the
repository.
The format is defined in Documentation/technical/pack-format.txt, and
stores a 4-byte network order timestamp for each object in name (index)
order.
This patch prepares for cruft packs by defining the `.mtimes` format,
and introducing a basic API that callers can use to read out individual
mtimes.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-mtimes.h')
-rw-r--r-- | pack-mtimes.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pack-mtimes.h b/pack-mtimes.h new file mode 100644 index 0000000000..cc957b3e85 --- /dev/null +++ b/pack-mtimes.h @@ -0,0 +1,26 @@ +#ifndef PACK_MTIMES_H +#define PACK_MTIMES_H + +#include "git-compat-util.h" + +#define MTIMES_SIGNATURE 0x4d544d45 /* "MTME" */ +#define MTIMES_VERSION 1 + +struct packed_git; + +/* + * Loads the .mtimes file corresponding to "p", if any, returning zero + * on success. + */ +int load_pack_mtimes(struct packed_git *p); + +/* Returns the mtime associated with the object at position "pos" (in + * lexicographic/index order) in pack "p". + * + * Note that it is a BUG() to call this function if either (a) "p" does + * not have a corresponding .mtimes file, or (b) it does, but it hasn't + * been loaded + */ +uint32_t nth_packed_mtime(struct packed_git *p, uint32_t pos); + +#endif |