Skip to content

Commit f332121

Browse files
newrengitster
authored andcommitted
treewide: remove unnecessary git-compat-util.h includes in headers
For sanity, we should probably 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 Currently, we have some of the headers following (a) and others following (b), which makes things messy. In the past I was pushed towards (b), as per [1] and [2]. Further, during this series I discovered that this mixture empirically will mean that we end up with C files that do not directly include git-compat-util.h, and do include headers that don't include git-compat-util.h, with the result that we likely have headers included before an indirect inclusion of git-compat-util.h. Since git-compat-util.h has tricky platform-specific stuff that is meant to be included before everything else, this state of affairs is risky and may lead to things breaking in subtle ways (and only on some platforms) as per [1] and [2]. Since including git-compat-util.h in existing header files makes it harder for us to catch C files that are missing that include, let's switch to (b) to make the enforcement of this rule easier. Remove the inclusion of git-compat-util.h from header files other than the ones that have been approved as alternate first includes. [1] https://lore.kernel.org/git/[email protected]/ [2] https://lore.kernel.org/git/[email protected]/ Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8bff5ca commit f332121

11 files changed

+0
-15
lines changed

advice.h

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#ifndef ADVICE_H
22
#define ADVICE_H
33

4-
#include "git-compat-util.h"
5-
64
struct string_list;
75

86
/*

cbtree.h

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#ifndef CBTREE_H
1515
#define CBTREE_H
1616

17-
#include "git-compat-util.h"
18-
1917
struct cb_node;
2018
struct cb_node {
2119
struct cb_node *child[2];

chunk-format.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef CHUNK_FORMAT_H
22
#define CHUNK_FORMAT_H
33

4-
#include "git-compat-util.h"
54
#include "hash.h"
65

76
struct hashfile;

commit-graph.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef COMMIT_GRAPH_H
22
#define COMMIT_GRAPH_H
33

4-
#include "git-compat-util.h"
54
#include "object-store.h"
65
#include "oidset.h"
76

commit-slab-impl.h

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#ifndef COMMIT_SLAB_IMPL_H
22
#define COMMIT_SLAB_IMPL_H
33

4-
#include "git-compat-util.h"
5-
64
#define implement_static_commit_slab(slabname, elemtype) \
75
implement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)
86

hash.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef HASH_H
22
#define HASH_H
33

4-
#include "git-compat-util.h"
54
#include "repository.h"
65

76
#if defined(SHA1_APPLE)

pack-mtimes.h

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#ifndef PACK_MTIMES_H
22
#define PACK_MTIMES_H
33

4-
#include "git-compat-util.h"
5-
64
#define MTIMES_SIGNATURE 0x4d544d45 /* "MTME" */
75
#define MTIMES_VERSION 1
86

pkt-line.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef PKTLINE_H
22
#define PKTLINE_H
33

4-
#include "git-compat-util.h"
54
#include "strbuf.h"
65
#include "sideband.h"
76

repository.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef REPOSITORY_H
22
#define REPOSITORY_H
33

4-
#include "git-compat-util.h"
54
#include "path.h"
65

76
struct config_set;

sub-process.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef SUBPROCESS_H
22
#define SUBPROCESS_H
33

4-
#include "git-compat-util.h"
54
#include "hashmap.h"
65
#include "run-command.h"
76

trace.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef TRACE_H
22
#define TRACE_H
33

4-
#include "git-compat-util.h"
54
#include "strbuf.h"
65

76
/**

0 commit comments

Comments
 (0)