treewide: remove unnecessary git-compat-util.h includes in headers
commitf332121e75d3aa2b0ce7efd120ac3ede19e9a733
authorElijah Newren <newren@gmail.com>
Fri, 24 Feb 2023 00:09:21 +0000 (24 00:09 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Feb 2023 01:25:28 +0000 (23 17:25 -0800)
treea574878798d23c1832a022d09234727649ccaa5d
parent8bff5ca030d314d613e1ab58f07b27914d6dfd33
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>
advice.h
cbtree.h
chunk-format.h
commit-graph.h
commit-slab-impl.h
hash.h
pack-mtimes.h
pkt-line.h
repository.h
sub-process.h
trace.h