Re: [PATCH 02/16] treewide: remove unnecessary git-compat-util.h includes in headers
On Thu, Feb 23, 2023 at 2:07 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 23 quoted lines
>
> Elijah Newren <newren@gmail.com> writes:
>
> > I think for sanity we should 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
> >
> > I think things get really messy if we let half the headers follow (a)
> > and the other half are forced to do (b). I was pushed towards (b)
> > before, but now that I've worked on this series, I think there is even
> > more reason to go this direction: this work I did during this series
> > shows that if we allow a mixture of (a) and (b), then empirically we
> > end up with C files that don't include git-compat-util.h directly, and
> > those same C files likely include some headers that don't include
> > git-compat-util.h at all, and if the other headers are included before
> > the indirect inclusion of git-compat-util.h then there are risks that
> > things will break in very subtle ways (as pointed out by Peff in the
> > above-linked emails). So, I'm inclined to go towards (b).
>
> Perfect. Can some of that reasoning be captured in the proposed log
> message of [02/16] to help future developers?