Subject: [PATCH] remove duplicate includes

From: René Scharfe <[email-masked]>
Date: Sun, 8 Feb 2026 13:32:22 +0100

The following command reports that some header files are included twice:

   $ git grep '#include' '*.c' | sort | uniq -cd

Remove the second #include line in each case, as it has no effect.

Signed-off-by: René Scharfe <[email-masked]>
---
Patch formatted with --function-context for easier review.

 builtin/blame.c        | 1 -
 builtin/log.c          | 1 -
 builtin/pack-objects.c | 1 -
 commit.c               | 1 -
 object-file-convert.c  | 1 -
 protocol-caps.c        | 1 -
 setup.c                | 1 -
 7 files changed, 7 deletions(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index 6044973462..6588161382 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1,37 +1,36 @@
 /*
  * Blame
  *
  * Copyright (c) 2006, 2014 by its authors
  * See COPYING for licensing conditions
  */
 
 #define USE_THE_REPOSITORY_VARIABLE
 
 #include "builtin.h"
 #include "config.h"
 #include "color.h"
-#include "builtin.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "commit.h"
 #include "diff.h"
 #include "revision.h"
 #include "quote.h"
 #include "string-list.h"
 #include "mailmap.h"
 #include "parse-options.h"
 #include "prio-queue.h"
 #include "utf8.h"
 #include "userdiff.h"
 #include "line-range.h"
 #include "line-log.h"
 #include "progress.h"
 #include "object-name.h"
 #include "odb.h"
 #include "pager.h"
 #include "blame.h"
 #include "refs.h"
 #include "setup.h"
 #include "tag.h"
 #include "write-or-die.h"
diff --git a/builtin/log.c b/builtin/log.c
index 5c9a8ef363..43af5047e3 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1,52 +1,51 @@
 /*
  * Builtin "git log" and related commands (show, whatchanged)
  *
  * (C) Copyright 2006 Linus Torvalds
  *		 2006 Junio Hamano
  */
 
 #define USE_THE_REPOSITORY_VARIABLE
 
 #include "builtin.h"
 #include "abspath.h"
 #include "config.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "refs.h"
 #include "object-name.h"
 #include "odb.h"
 #include "odb/streaming.h"
 #include "pager.h"
 #include "color.h"
 #include "commit.h"
 #include "diff.h"
 #include "diff-merges.h"
 #include "revision.h"
 #include "log-tree.h"
-#include "builtin.h"
 #include "oid-array.h"
 #include "tag.h"
 #include "reflog-walk.h"
 #include "patch-ids.h"
 #include "path.h"
 #include "shortlog.h"
 #include "remote.h"
 #include "string-list.h"
 #include "parse-options.h"
 #include "line-log.h"
 #include "branch.h"
 #include "version.h"
 #include "mailmap.h"
 #include "progress.h"
 #include "commit-slab.h"
 
 #include "commit-reach.h"
 #include "range-diff.h"
 #include "tmp-objdir.h"
 #include "tree.h"
 #include "write-or-die.h"
 
 #define MAIL_DEFAULT_WRAP 72
 #define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100
 #define FORMAT_PATCH_NAME_MAX_DEFAULT 64
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 5846b6a293..9768c7bf0b 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1,53 +1,52 @@
 #define USE_THE_REPOSITORY_VARIABLE
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "builtin.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "config.h"
 #include "attr.h"
 #include "object.h"
 #include "commit.h"
 #include "tag.h"
 #include "delta.h"
 #include "pack.h"
 #include "pack-revindex.h"
 #include "csum-file.h"
 #include "tree-walk.h"
 #include "diff.h"
 #include "revision.h"
 #include "list-objects.h"
 #include "list-objects-filter-options.h"
 #include "pack-objects.h"
 #include "progress.h"
 #include "refs.h"
 #include "thread-utils.h"
 #include "pack-bitmap.h"
 #include "delta-islands.h"
 #include "reachable.h"
 #include "oid-array.h"
 #include "strvec.h"
 #include "list.h"
 #include "packfile.h"
 #include "object-file.h"
 #include "odb.h"
 #include "odb/streaming.h"
 #include "replace-object.h"
 #include "dir.h"
 #include "midx.h"
 #include "trace2.h"
 #include "shallow.h"
 #include "promisor-remote.h"
 #include "pack-mtimes.h"
 #include "parse-options.h"
 #include "blob.h"
 #include "tree.h"
 #include "path-walk.h"
-#include "trace2.h"
 
 /*
  * Objects we are going to pack are collected in the `to_pack` structure.
  * It contains an array (dynamically expanded) of the object data, and a map
  * that can resolve SHA1s to their position in the array.
  */
diff --git a/commit.c b/commit.c
index 28bb5ce029..515d77e7d3 100644
--- a/commit.c
+++ b/commit.c
@@ -1,37 +1,36 @@
 #define USE_THE_REPOSITORY_VARIABLE
 
 #include "git-compat-util.h"
 #include "tag.h"
 #include "commit.h"
 #include "commit-graph.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "repository.h"
 #include "object-name.h"
 #include "odb.h"
 #include "utf8.h"
 #include "diff.h"
 #include "revision.h"
 #include "notes.h"
 #include "alloc.h"
 #include "gpg-interface.h"
 #include "mergesort.h"
 #include "commit-slab.h"
 #include "prio-queue.h"
 #include "hash-lookup.h"
 #include "wt-status.h"
 #include "advice.h"
 #include "refs.h"
 #include "commit-reach.h"
 #include "setup.h"
 #include "shallow.h"
 #include "tree.h"
 #include "hook.h"
 #include "parse.h"
 #include "object-file.h"
 #include "object-file-convert.h"
-#include "prio-queue.h"
 
 static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
 
diff --git a/object-file-convert.c b/object-file-convert.c
index 7ab875afe6..7813286596 100644
--- a/object-file-convert.c
+++ b/object-file-convert.c
@@ -1,14 +1,13 @@
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
 #include "gettext.h"
 #include "strbuf.h"
 #include "hex.h"
 #include "repository.h"
 #include "hash.h"
-#include "hash.h"
 #include "object.h"
 #include "loose.h"
 #include "commit.h"
 #include "gpg-interface.h"
 #include "object-file-convert.h"
diff --git a/protocol-caps.c b/protocol-caps.c
index ecdd0dc58d..35072ed60b 100644
--- a/protocol-caps.c
+++ b/protocol-caps.c
@@ -1,12 +1,11 @@
 #include "git-compat-util.h"
 #include "protocol-caps.h"
 #include "gettext.h"
 #include "hex.h"
 #include "pkt-line.h"
 #include "hash.h"
-#include "hex.h"
 #include "object.h"
 #include "odb.h"
 #include "repository.h"
 #include "string-list.h"
 #include "strbuf.h"
diff --git a/setup.c b/setup.c
index 11fe7f8841..c8336eb20e 100644
--- a/setup.c
+++ b/setup.c
@@ -1,31 +1,30 @@
 #define USE_THE_REPOSITORY_VARIABLE
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
 #include "abspath.h"
 #include "copy.h"
 #include "environment.h"
 #include "exec-cmd.h"
 #include "gettext.h"
 #include "hex.h"
 #include "object-file.h"
 #include "object-name.h"
 #include "refs.h"
 #include "replace-object.h"
 #include "repository.h"
 #include "config.h"
 #include "dir.h"
 #include "setup.h"
 #include "shallow.h"
 #include "string-list.h"
 #include "strvec.h"
 #include "chdir-notify.h"
 #include "path.h"
 #include "quote.h"
 #include "trace.h"
 #include "trace2.h"
 #include "worktree.h"
-#include "exec-cmd.h"
 
 static int inside_git_dir = -1;
 static int inside_work_tree = -1;
-- 
2.52.0