Re: [PATCH 02/16] treewide: remove unnecessary git-compat-util.h includes in headers
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 23, 2023, 22:07 UTC
- Message-ID
- <xmqqbklk6nnt.fsf@gitster.g>
- In-Reply-To
- <CABPp-BHizCj2e454w3vtHrDNip3Rm-gUMT0oJiAsbkAvr_QvVA@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 17 quoted lines
> 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?
Thanks.