Re: [PATCH] git: remove duplicate includes
- From
Jeff King <peff@peff.net>
- Date
- Dec 14, 2022, 20:53 UTC
- Message-ID
- <Y5o33g7sEljanQjv@coredump.intra.peff.net>
- In-Reply-To
- <pull.1394.git.git.1671036743272.gitgitgadget@gmail.com>
On Wed, Dec 14, 2022 at 04:52:23PM +0000, Rose via GitGitGadget wrote:
> These files are already included; we do not need to include them again
These all look good to me. I'm guessing you found them with something like:
git grep '^#include' '*.h' '*.c' | sort | uniq -d
and then looking over the output (it has many false positives because sometimes includes are found in multiple conditionals).
There's one more in compat/regex/regex.h, where we include stddef.h unconditionally, but also if HAVE_STDDEF_H is defined (which I think we'd never set ourselves). The conditional bit comes from upstream, I think, via d18f76dccf (compat/regex: use the regex engine from gawk for compat, 2010-08-17). The unconditional one is from just after that, in a997bf423d (compat/regex: get the gawk regex engine to compile within git, 2010-08-17).
It's probably best to leave it as-is, since the "clean" fix would be to remove the unused conditional, but that takes us further from upstream, which would be a pain if we ever want to re-import a new version.
So I think your patch covers all of the cases we'd want to fix.
-Peff