This series fixes compilation errors when using a simple test.c file that
includes git-compat-util.h and then exactly one other header (and repeating
this for different headers of git).
Changes in this series come from Jonathan Nieder's reviews; full
range-diff follows below, but in summary:
- Squashed the final patch from the previous series into the first (Junio
already applied a previous round and resolved the simple conflicts with
next and pu, so making it easy to drop doesn't save effort anymore.)
- Added a new patch to the series removing the forward declaration of
an enum, for portability reasons.
- Added Jonathan's Reviewed-by on the relevant patches
- Remove a few includes and forward declares (which were initially added
in previous rounds of this series) that are no longer necessary (due to
other includes)
- Fixed wording in commit message for patch 1 and added some comments
about methodology used to come up with the patch.
Elijah Newren (6):
Add missing includes and forward declarations
alloc: make allocate_alloc_state and clear_alloc_state more consistent
Move definition of enum branch_track from cache.h to branch.h
urlmatch.h: fix include guard
compat/precompose_utf8.h: use more common include guard style
Remove forward declaration of an enum
alloc.c | 2 +-
alloc.h | 4 +++-
apply.h | 3 +++
archive.h | 1 +
attr.h | 1 +
bisect.h | 2 ++
branch.h | 13 +++++++++++++
bulk-checkin.h | 2 ++
cache.h | 10 ----------
column.h | 1 +
commit-graph.h | 1 +
compat/precompose_utf8.h | 3 ++-
config.c | 1 +
config.h | 5 +++++
connected.h | 1 +
convert.h | 2 ++
csum-file.h | 2 ++
diffcore.h | 4 ++++
dir-iterator.h | 2 ++
environment.c | 1 +
fsck.h | 1 +
fsmonitor.h | 3 +++
gpg-interface.h | 2 ++
khash.h | 3 +++
list-objects-filter.h | 4 ++++
list-objects.h | 4 ++++
ll-merge.h | 2 ++
mailinfo.h | 2 ++
mailmap.h | 2 ++
merge-recursive.h | 4 +++-
notes-merge.h | 4 ++++
notes-utils.h | 3 +++
notes.h | 3 +++
object-store.h | 1 +
object.h | 2 ++
oidmap.h | 1 +
pack-bitmap.h | 3 +++
pack-objects.h | 1 +
packfile.h | 2 +-
patch-ids.h | 6 ++++++
path.h | 1 +
pathspec.h | 2 ++
pretty.h | 4 ++++
reachable.h | 2 ++
reflog-walk.h | 1 +
refs.h | 2 ++
remote.h | 1 +
repository.h | 2 ++
resolve-undo.h | 2 ++
revision.h | 1 +
send-pack.h | 4 ++++
sequencer.h | 5 +++++
shortlog.h | 2 ++
submodule.h | 10 ++++++++--
tempfile.h | 1 +
trailer.h | 2 ++
tree-walk.h | 2 ++
unpack-trees.h | 5 ++++-
url.h | 2 ++
urlmatch.h | 2 ++
utf8.h | 2 ++
worktree.h | 1 +
62 files changed, 152 insertions(+), 18 deletions(-)
1: f7d50cef3b ! 1: e6a93208b2 Add missing includes and forward declares
@@ -1,6 +1,13 @@
Author: Elijah Newren <[email protected]>
- Add missing includes and forward declares
+ Add missing includes and forward declarations
+
+ I looped over the toplevel header files, creating a temporary two-line
C
+ program for each consisting of
+ #include "git-compat-util.h"
+ #include $HEADER
+ This patch is the result of manually fixing errors in compiling those
+ tiny programs.
Signed-off-by: Elijah Newren <[email protected]>
@@ -38,15 +45,13 @@
--- a/archive.h
+++ b/archive.h
@@
+ #ifndef ARCHIVE_H
+ #define ARCHIVE_H
++#include "cache.h"
#include "pathspec.h"
-+struct object_id;
-+enum object_type;
-+
struct archiver_args {
- const char *base;
- size_t baselen;
diff --git a/attr.h b/attr.h
--- a/attr.h
@@ -60,6 +65,19 @@
/*
* Given a string, return the gitattribute object that
+diff --git a/bisect.h b/bisect.h
+--- a/bisect.h
++++ b/bisect.h
+@@
+ #ifndef BISECT_H
+ #define BISECT_H
+
++struct commit_list;
++
+ /*
+ * Find bisection. If something is found, `reaches` will be the number of
+ * commits that the best commit reaches. `all` will be the count of
+
diff --git a/branch.h b/branch.h
--- a/branch.h
+++ b/branch.h
@@ -213,10 +231,6 @@
+#include "cache.h"
+#include "dir.h"
-+
-+struct cache_entry;
-+struct index_state;
-+struct strbuf;
+
extern struct trace_key trace_fsmonitor;
@@ -428,6 +442,18 @@
char magic[4];
uint16_t version;
+diff --git a/pack-objects.h b/pack-objects.h
+--- a/pack-objects.h
++++ b/pack-objects.h
+@@
+ #define PACK_OBJECTS_H
+
+ #include "object-store.h"
++#include "pack.h"
+
+ #define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)
+
+
diff --git a/patch-ids.h b/patch-ids.h
--- a/patch-ids.h
+++ b/patch-ids.h
@@ -464,9 +490,6 @@
#ifndef PATHSPEC_H
#define PATHSPEC_H
-+#include "string.h"
-+#include "strings.h"
-+
+struct index_state;
+
/* Pathspec magic */
2: e46bf7d601 ! 2: f199566088 alloc: make allocate_alloc_state and
clear_alloc_state more consistent
@@ -6,6 +6,7 @@
refer to it as void *, or both use the real type (struct alloc_state
*).
Opt for the latter.
+ Reviewed-by: Jonathan Nieder <[email protected]>
Signed-off-by: Elijah Newren <[email protected]>
diff --git a/alloc.c b/alloc.c
3: aec8ddda59 ! 3: 169c90a96f Move definition of enum branch_track from
cache.h to branch.h
@@ -7,6 +7,7 @@
for this small enum, just move the enum and the external declaration
for git_branch_track to branch.h.
+ Reviewed-by: Jonathan Nieder <[email protected]>
Signed-off-by: Elijah Newren <[email protected]>
diff --git a/branch.h b/branch.h
4: 14e33fb5ff ! 4: 5a36e50d4d urlmatch.h: fix include guard
@@ -2,6 +2,7 @@
urlmatch.h: fix include guard
+ Reviewed-by: Jonathan Nieder <[email protected]>
Signed-off-by: Elijah Newren <[email protected]>
diff --git a/urlmatch.h b/urlmatch.h
5: 3e02a381af ! 5: 8f247b24a7 compat/precompose_utf8.h: use more common
include guard style
@@ -2,6 +2,7 @@
compat/precompose_utf8.h: use more common include guard style
+ Reviewed-by: Jonathan Nieder <[email protected]>
Signed-off-by: Elijah Newren <[email protected]>
diff --git a/compat/precompose_utf8.h b/compat/precompose_utf8.h
6: aca61bade1 < -: ---------- Add missing includes and forward declares
-: ---------- > 6: 74975b7909 Remove forward declaration of an enum
--
2.18.0.553.g74975b7909