Commit 0fb4b3519c32914073016f566555286c10e80fac

Patrick Steinhardt 2017-06-30T13:27:26

Fix missing include for header files Some of our header files are not included at all by any of their implementing counter-parts. Including them inside of these files leads to some compile errors mostly due to unknown types because of missing includes. But there's also one case where a declared function does not match the implementation's prototype. Fix all these errors by fixing up the prototype and adding missing includes. This is preparatory work for fixing up missing includes in the implementation files.

diff --git a/src/clone.h b/src/clone.h
index 14ca5d4..fa20498 100644
--- a/src/clone.h
+++ b/src/clone.h
@@ -7,6 +7,8 @@
 #ifndef INCLUDE_clone_h__
 #define INCLUDE_clone_h__
 
+#include "git2/clone.h"
+
 extern int git_clone__should_clone_local(const char *url, git_clone_local_t local);
 
 #endif
diff --git a/src/diff_generate.h b/src/diff_generate.h
index 63e7f05..8b974be 100644
--- a/src/diff_generate.h
+++ b/src/diff_generate.h
@@ -7,6 +7,10 @@
 #ifndef INCLUDE_diff_generate_h__
 #define INCLUDE_diff_generate_h__
 
+#include "diff.h"
+#include "pool.h"
+#include "index.h"
+
 enum {
 	GIT_DIFFCAPS_HAS_SYMLINKS     = (1 << 0), /* symlinks on platform? */
 	GIT_DIFFCAPS_IGNORE_STAT      = (1 << 1), /* use stat? */
diff --git a/src/diff_tform.h b/src/diff_tform.h
index 5bd9712..dbb4b54 100644
--- a/src/diff_tform.h
+++ b/src/diff_tform.h
@@ -7,6 +7,8 @@
 #ifndef INCLUDE_diff_tform_h__
 #define INCLUDE_diff_tform_h__
 
+#include "diff_file.h"
+
 extern int git_diff_find_similar__hashsig_for_file(
 	void **out, const git_diff_file *f, const char *path, void *p);
 
diff --git a/src/fetch.h b/src/fetch.h
index 0412d4e..4cdbf3b 100644
--- a/src/fetch.h
+++ b/src/fetch.h
@@ -7,6 +7,8 @@
 #ifndef INCLUDE_fetch_h__
 #define INCLUDE_fetch_h__
 
+#include "git2/remote.h"
+
 #include "netops.h"
 
 int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts);
diff --git a/src/fetchhead.h b/src/fetchhead.h
index b03bd0f..69a1e86 100644
--- a/src/fetchhead.h
+++ b/src/fetchhead.h
@@ -7,6 +7,7 @@
 #ifndef INCLUDE_fetchhead_h__
 #define INCLUDE_fetchhead_h__
 
+#include "oid.h"
 #include "vector.h"
 
 typedef struct git_fetchhead_ref {
diff --git a/src/indexer.h b/src/indexer.h
index 702694b..cae3140 100644
--- a/src/indexer.h
+++ b/src/indexer.h
@@ -7,6 +7,8 @@
 #ifndef INCLUDE_indexer_h__
 #define INCLUDE_indexer_h__
 
-extern int git_indexer__set_fsync(git_indexer *idx, int do_fsync);
+#include "git2/indexer.h"
+
+extern void git_indexer__set_fsync(git_indexer *idx, int do_fsync);
 
 #endif
diff --git a/src/patch_parse.h b/src/patch_parse.h
index 99eb458..5c4d04f 100644
--- a/src/patch_parse.h
+++ b/src/patch_parse.h
@@ -7,6 +7,8 @@
 #ifndef INCLUDE_patch_parse_h__
 #define INCLUDE_patch_parse_h__
 
+#include "patch.h"
+
 typedef struct {
 	git_refcount rc;
 
diff --git a/src/refdb_fs.h b/src/refdb_fs.h
index 79e2968..a979383 100644
--- a/src/refdb_fs.h
+++ b/src/refdb_fs.h
@@ -7,6 +7,8 @@
 #ifndef INCLUDE_refdb_fs_h__
 #define INCLUDE_refdb_fs_h__
 
+#include "strmap.h"
+
 typedef struct {
 	git_strmap *packfile;
 	time_t packfile_time;
diff --git a/src/util.h b/src/util.h
index 1ff5080..8bba368 100644
--- a/src/util.h
+++ b/src/util.h
@@ -9,6 +9,7 @@
 
 #include "git2/buffer.h"
 #include "buffer.h"
+#include "thread-utils.h"
 
 #include "common.h"
 #include "strnlen.h"
@@ -286,8 +287,6 @@ extern int git__strncasecmp(const char *a, const char *b, size_t sz);
 
 extern int git__strcasesort_cmp(const char *a, const char *b);
 
-#include "thread-utils.h"
-
 typedef struct {
 	git_atomic refcount;
 	void *owner;