git/pack-mtimes.h
Elijah Newren f332121e75 treewide: remove unnecessary git-compat-util.h includes in headers
For sanity, we should probably do one of the following:

(a) make C and header files both depend upon everything they need
(b) consistently exclude git-compat-util.h from headers and require it
    be the first include in C files

Currently, we have some of the headers following (a) and others
following (b), which makes things messy.  In the past I was pushed
towards (b), as per [1] and [2].  Further, during this series I
discovered that this mixture empirically will mean that we end up with C
files that do not directly include git-compat-util.h, and do include
headers that don't include git-compat-util.h, with the result that we
likely have headers included before an indirect inclusion of
git-compat-util.h.  Since git-compat-util.h has tricky platform-specific
stuff that is meant to be included before everything else, this state of
affairs is risky and may lead to things breaking in subtle ways (and
only on some platforms) as per [1] and [2].

Since including git-compat-util.h in existing header files makes it
harder for us to catch C files that are missing that include, let's
switch to (b) to make the enforcement of this rule easier.  Remove the
inclusion of git-compat-util.h from header files other than the ones
that have been approved as alternate first includes.

[1] https://lore.kernel.org/git/20180811173406.GA9119@sigill.intra.peff.net/
[2] https://lore.kernel.org/git/20180811174301.GA9287@sigill.intra.peff.net/

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-02-23 17:25:28 -08:00

24 lines
628 B
C

#ifndef PACK_MTIMES_H
#define PACK_MTIMES_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