diff mbox series

git: remove duplicate includes

Message ID pull.1394.git.git.1671036743272.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit 92cb135855b71333a77aabe7b5364189c66bf07b
Headers show
Series git: remove duplicate includes | expand

Commit Message

Seija Kijin Dec. 14, 2022, 4:52 p.m. UTC
From: Seija Kijin <doremylover123@gmail.com>

These files are already included; we do not need to include them again

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
    git: remove duplicate includes
    
    These files are already included; we do not need to include them again
    
    Signed-off-by: Seija Kijin doremylover123@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1394%2FAtariDreams%2Finclude-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1394/AtariDreams/include-v1
Pull-Request: https://github.com/git/git/pull/1394

 pack-write.c   | 1 -
 sequencer.c    | 1 -
 unpack-trees.c | 1 -
 3 files changed, 3 deletions(-)


base-commit: 57e2c6ebbe7108b35ba30184dcbcb6c34c929ad8

Comments

Jeff King Dec. 14, 2022, 8:53 p.m. UTC | #1
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
diff mbox series

Patch

diff --git a/pack-write.c b/pack-write.c
index 00787e306db..33637297487 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -5,7 +5,6 @@ 
 #include "chunk-format.h"
 #include "pack-mtimes.h"
 #include "oidmap.h"
-#include "chunk-format.h"
 #include "pack-objects.h"
 
 void reset_pack_idx_option(struct pack_idx_option *opts)
diff --git a/sequencer.c b/sequencer.c
index dbd56121e24..bcb662e23be 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -36,7 +36,6 @@ 
 #include "rebase-interactive.h"
 #include "reset.h"
 #include "branch.h"
-#include "log-tree.h"
 
 #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
 
diff --git a/unpack-trees.c b/unpack-trees.c
index 8a762aa0772..d11bef96bf3 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -19,7 +19,6 @@ 
 #include "promisor-remote.h"
 #include "entry.h"
 #include "parallel-checkout.h"
-#include "sparse-index.h"
 
 /*
  * Error messages expected by scripts out of plumbing commands such as