git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Rose via GitGitGadget
Message 2 of 2 in “git: remove duplicate includes”
  1. git: remove duplicate includesRose via GitGitGadget, Dec 14, 2022
  2. Jeff KingDec 14, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.