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 <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Aug 15, 2018 at 10:54 UTC ef3ca95475ce467ae883cc8175ed40e6f7d27800
55 files changed +132 -4
alloc.h
+2
@@ -1,9 +1,11 @@
1 #ifndef ALLOC_H
2 #define ALLOC_H
3
4 +struct alloc_state;
5 struct tree;
6 struct commit;
7 struct tag;
8 +struct repository;
9
10 void *alloc_blob_node(struct repository *r);
11 void *alloc_tree_node(struct repository *r);
apply.h
+3
@@ -1,6 +1,9 @@
1 #ifndef APPLY_H
2 #define APPLY_H
3
4 +#include "lockfile.h"
5 +#include "string-list.h"
6 +
7 enum apply_ws_error_action {
8 nowarn_ws_error,
9 warn_on_ws_error,
archive.h
+1
@@ -1,6 +1,7 @@
1 #ifndef ARCHIVE_H
2 #define ARCHIVE_H
3
4 +#include "cache.h"
5 #include "pathspec.h"
6
7 struct archiver_args {
attr.h
+1
@@ -7,6 +7,7 @@ struct git_attr;
7 /* opaque structures used internally for attribute collection */
8 struct all_attrs_item;
9 struct attr_stack;
10 +struct index_state;
11
12 /*
13 * Given a string, return the gitattribute object that
bisect.h
+2
@@ -1,6 +1,8 @@
1 #ifndef BISECT_H
2 #define BISECT_H
3
4 +struct commit_list;
5 +
6 /*
7 * Find bisection. If something is found, `reaches` will be the number of
8 * commits that the best commit reaches. `all` will be the count of
branch.h
+2
@@ -1,6 +1,8 @@
1 #ifndef BRANCH_H
2 #define BRANCH_H
3
4 +struct strbuf;
5 +
6 /* Functions for acting on the information about branches. */
7
8 /*
bulk-checkin.h
+2
@@ -4,6 +4,8 @@
4 #ifndef BULK_CHECKIN_H
5 #define BULK_CHECKIN_H
6
7 +#include "cache.h"
8 +
9 extern int index_bulk_checkin(struct object_id *oid,
10 int fd, size_t size, enum object_type type,
11 const char *path, unsigned flags);
column.h
+1
@@ -36,6 +36,7 @@ static inline int column_active(unsigned int colopts)
36 return (colopts & COL_ENABLE_MASK) == COL_ENABLED;
37 }
38
39 +struct string_list;
40 extern void print_columns(const struct string_list *list, unsigned int colopts,
41 const struct column_options *opts);
42
commit-graph.h
+1
@@ -4,6 +4,7 @@
4 #include "git-compat-util.h"
5 #include "repository.h"
6 #include "string-list.h"
7 +#include "cache.h"
8
9 struct commit;
10
config.h
+5
@@ -1,6 +1,11 @@
1 #ifndef CONFIG_H
2 #define CONFIG_H
3
4 +#include "hashmap.h"
5 +#include "string-list.h"
6 +
7 +struct object_id;
8 +
9 /* git_config_parse_key() returns these negated: */
10 #define CONFIG_INVALID_KEY 1
11 #define CONFIG_NO_SECTION_OR_NAME 2
connected.h
+1
@@ -1,6 +1,7 @@
1 #ifndef CONNECTED_H
2 #define CONNECTED_H
3
4 +struct object_id;
5 struct transport;
6
7 /*
convert.h
+2
@@ -7,6 +7,8 @@
7 #include "string-list.h"
8
9 struct index_state;
10 +struct object_id;
11 +struct strbuf;
12
13 #define CONV_EOL_RNDTRP_DIE (1<<0) /* Die if CRLF to LF to CRLF is different */
14 #define CONV_EOL_RNDTRP_WARN (1<<1) /* Warn if CRLF to LF to CRLF is different */
csum-file.h
+2
@@ -1,6 +1,8 @@
1 #ifndef CSUM_FILE_H
2 #define CSUM_FILE_H
3
4 +#include "hash.h"
5 +
6 struct progress;
7
8 /* A SHA1-protected file */
diffcore.h
+4
@@ -4,6 +4,10 @@
4 #ifndef DIFFCORE_H
5 #define DIFFCORE_H
6
7 +#include "cache.h"
8 +
9 +struct diff_options;
10 +
11 /* This header file is internal between diff.c and its diff transformers
12 * (e.g. diffcore-rename, diffcore-pickaxe). Never include this header
13 * in anything else.
dir-iterator.h
+2
@@ -1,6 +1,8 @@
1 #ifndef DIR_ITERATOR_H
2 #define DIR_ITERATOR_H
3
4 +#include "strbuf.h"
5 +
6 /*
7 * Iterate over a directory tree.
8 *
fsck.h
+1
@@ -6,6 +6,7 @@
6 #define FSCK_IGNORE 3
7
8 struct fsck_options;
9 +struct object;
10
11 void fsck_set_msg_type(struct fsck_options *options,
12 const char *msg_id, const char *msg_type);
fsmonitor.h
+3
@@ -1,6 +1,9 @@
1 #ifndef FSMONITOR_H
2 #define FSMONITOR_H
3
4 +#include "cache.h"
5 +#include "dir.h"
6 +
7 extern struct trace_key trace_fsmonitor;
8
9 /*
gpg-interface.h
+2
@@ -1,6 +1,8 @@
1 #ifndef GPG_INTERFACE_H
2 #define GPG_INTERFACE_H
3
4 +struct strbuf;
5 +
6 #define GPG_VERIFY_VERBOSE 1
7 #define GPG_VERIFY_RAW 2
8 #define GPG_VERIFY_OMIT_STATUS 4
khash.h
+3
@@ -26,6 +26,9 @@
26 #ifndef __AC_KHASH_H
27 #define __AC_KHASH_H
28
29 +#include "cache.h"
30 +#include "hashmap.h"
31 +
32 #define AC_VERSION_KHASH_H "0.2.8"
33
34 typedef uint32_t khint32_t;
list-objects-filter.h
+4
@@ -1,6 +1,10 @@
1 #ifndef LIST_OBJECTS_FILTER_H
2 #define LIST_OBJECTS_FILTER_H
3
4 +struct list_objects_filter_options;
5 +struct object;
6 +struct oidset;
7 +
8 /*
9 * During list-object traversal we allow certain objects to be
10 * filtered (omitted) from the result. The active filter uses
list-objects.h
+4
@@ -1,6 +1,10 @@
1 #ifndef LIST_OBJECTS_H
2 #define LIST_OBJECTS_H
3
4 +struct commit;
5 +struct object;
6 +struct rev_info;
7 +
8 typedef void (*show_commit_fn)(struct commit *, void *);
9 typedef void (*show_object_fn)(struct object *, const char *, void *);
10 void traverse_commit_list(struct rev_info *, show_commit_fn, show_object_fn, void *);
ll-merge.h
+2
@@ -5,6 +5,8 @@
5 #ifndef LL_MERGE_H
6 #define LL_MERGE_H
7
8 +#include "xdiff/xdiff.h"
9 +
10 struct ll_merge_options {
11 unsigned virtual_ancestor : 1;
12 unsigned variant : 2; /* favor ours, favor theirs, or union merge */
mailinfo.h
+2
@@ -1,6 +1,8 @@
1 #ifndef MAILINFO_H
2 #define MAILINFO_H
3
4 +#include "strbuf.h"
5 +
6 #define MAX_BOUNDARIES 5
7
8 struct mailinfo {
mailmap.h
+2
@@ -1,6 +1,8 @@
1 #ifndef MAILMAP_H
2 #define MAILMAP_H
3
4 +struct string_list;
5 +
6 int read_mailmap(struct string_list *map, char **repo_abbrev);
7 void clear_mailmap(struct string_list *map);
8
merge-recursive.h
+3 -1
@@ -1,8 +1,10 @@
1 #ifndef MERGE_RECURSIVE_H
2 #define MERGE_RECURSIVE_H
3
4 -#include "unpack-trees.h"
4 #include "string-list.h"
5 +#include "unpack-trees.h"
6 +
7 +struct commit;
8
9 struct merge_options {
10 const char *ancestor;
notes-merge.h
+4
@@ -2,6 +2,10 @@
2 #define NOTES_MERGE_H
3
4 #include "notes-utils.h"
5 +#include "strbuf.h"
6 +
7 +struct commit;
8 +struct object_id;
9
10 #define NOTES_MERGE_WORKTREE "NOTES_MERGE_WORKTREE"
11
notes-utils.h
+3
@@ -3,6 +3,9 @@
3
4 #include "notes.h"
5
6 +struct commit_list;
7 +struct object_id;
8 +
9 /*
10 * Create new notes commit from the given notes tree
11 *
notes.h
+3
@@ -3,6 +3,9 @@
3
4 #include "string-list.h"
5
6 +struct object_id;
7 +struct strbuf;
8 +
9 /*
10 * Function type for combining two notes annotating the same object.
11 *
object-store.h
+1
@@ -1,6 +1,7 @@
1 #ifndef OBJECT_STORE_H
2 #define OBJECT_STORE_H
3
4 +#include "cache.h"
5 #include "oidmap.h"
6 #include "list.h"
7 #include "sha1-array.h"
object.h
+2
@@ -1,6 +1,8 @@
1 #ifndef OBJECT_H
2 #define OBJECT_H
3
4 +#include "cache.h"
5 +
6 struct buffer_slab;
7
8 struct parsed_object_pool {
oidmap.h
+1
@@ -1,6 +1,7 @@
1 #ifndef OIDMAP_H
2 #define OIDMAP_H
3
4 +#include "cache.h"
5 #include "hashmap.h"
6
7 /*
pack-bitmap.h
+3
@@ -5,6 +5,9 @@
5 #include "khash.h"
6 #include "pack-objects.h"
7
8 +struct commit;
9 +struct rev_info;
10 +
11 struct bitmap_disk_header {
12 char magic[4];
13 uint16_t version;
pack-objects.h
+1
@@ -2,6 +2,7 @@
2 #define PACK_OBJECTS_H
3
4 #include "object-store.h"
5 +#include "pack.h"
6
7 #define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)
8
patch-ids.h
+6
@@ -1,6 +1,12 @@
1 #ifndef PATCH_IDS_H
2 #define PATCH_IDS_H
3
4 +#include "diff.h"
5 +#include "hashmap.h"
6 +
7 +struct commit;
8 +struct object_id;
9 +
10 struct patch_id {
11 struct hashmap_entry ent;
12 struct object_id patch_id;
path.h
+1
@@ -2,6 +2,7 @@
2 #define PATH_H
3
4 struct repository;
5 +struct strbuf;
6
7 /*
8 * The result to all functions which return statically allocated memory may be
pathspec.h
+2
@@ -1,6 +1,8 @@
1 #ifndef PATHSPEC_H
2 #define PATHSPEC_H
3
4 +struct index_state;
5 +
6 /* Pathspec magic */
7 #define PATHSPEC_FROMTOP (1<<0)
8 #define PATHSPEC_MAXDEPTH (1<<1)
pretty.h
+4
@@ -1,7 +1,11 @@
1 #ifndef PRETTY_H
2 #define PRETTY_H
3
4 +#include "cache.h"
5 +#include "string-list.h"
6 +
7 struct commit;
8 +struct strbuf;
9
10 /* Commit formats */
11 enum cmit_fmt {
reachable.h
+2
@@ -2,6 +2,8 @@
2 #define REACHEABLE_H
3
4 struct progress;
5 +struct rev_info;
6 +
7 extern int add_unseen_recent_objects_to_traversal(struct rev_info *revs,
8 timestamp_t timestamp);
9 extern void mark_reachable_objects(struct rev_info *revs, int mark_reflog,
reflog-walk.h
+1
@@ -3,6 +3,7 @@
3
4 #include "cache.h"
5
6 +struct commit;
7 struct reflog_walk_info;
8
9 extern void init_reflog_walk(struct reflog_walk_info **info);
refs.h
+2
@@ -3,8 +3,10 @@
3
4 struct object_id;
5 struct ref_store;
6 +struct repository;
7 struct strbuf;
8 struct string_list;
9 +struct string_list_item;
10 struct worktree;
11
12 /*
remote.h
+1
@@ -1,6 +1,7 @@
1 #ifndef REMOTE_H
2 #define REMOTE_H
3
4 +#include "cache.h"
5 #include "parse-options.h"
6 #include "hashmap.h"
7 #include "refspec.h"
repository.h
+2
@@ -1,6 +1,8 @@
1 #ifndef REPOSITORY_H
2 #define REPOSITORY_H
3
4 +#include "path.h"
5 +
6 struct config_set;
7 struct git_hash_algo;
8 struct index_state;
resolve-undo.h
+2
@@ -1,6 +1,8 @@
1 #ifndef RESOLVE_UNDO_H
2 #define RESOLVE_UNDO_H
3
4 +#include "cache.h"
5 +
6 struct resolve_undo_info {
7 unsigned int mode[3];
8 struct object_id oid[3];
revision.h
+1
@@ -1,6 +1,7 @@
1 #ifndef REVISION_H
2 #define REVISION_H
3
4 +#include "commit.h"
5 #include "parse-options.h"
6 #include "grep.h"
7 #include "notes.h"
send-pack.h
+4
@@ -3,6 +3,10 @@
3
4 #include "string-list.h"
5
6 +struct child_process;
7 +struct oid_array;
8 +struct ref;
9 +
10 /* Possible values for push_cert field in send_pack_args. */
11 #define SEND_PACK_PUSH_CERT_NEVER 0
12 #define SEND_PACK_PUSH_CERT_IF_ASKED 1
sequencer.h
+5
@@ -1,6 +1,11 @@
1 #ifndef SEQUENCER_H
2 #define SEQUENCER_H
3
4 +#include "cache.h"
5 +#include "strbuf.h"
6 +
7 +struct commit;
8 +
9 const char *git_path_commit_editmsg(void);
10 const char *git_path_seq_dir(void);
11
shortlog.h
+2
@@ -3,6 +3,8 @@
3
4 #include "string-list.h"
5
6 +struct commit;
7 +
8 struct shortlog {
9 struct string_list list;
10 int summary;
submodule.h
+8 -2
@@ -1,11 +1,17 @@
1 #ifndef SUBMODULE_H
2 #define SUBMODULE_H
3
4 -struct repository;
5 -struct diff_options;
4 struct argv_array;
5 +struct cache_entry;
6 +struct diff_options;
7 +struct index_state;
8 +struct object_id;
9 struct oid_array;
10 +struct pathspec;
11 struct remote;
12 +struct repository;
13 +struct string_list;
14 +struct strbuf;
15
16 enum {
17 RECURSE_SUBMODULES_ONLY = -5,
tempfile.h
+1
@@ -2,6 +2,7 @@
2 #define TEMPFILE_H
3
4 #include "list.h"
5 +#include "strbuf.h"
6
7 /*
8 * Handle temporary files.
trailer.h
+2
@@ -3,6 +3,8 @@
3
4 #include "list.h"
5
6 +struct strbuf;
7 +
8 enum trailer_where {
9 WHERE_DEFAULT,
10 WHERE_END,
tree-walk.h
+2
@@ -1,6 +1,8 @@
1 #ifndef TREE_WALK_H
2 #define TREE_WALK_H
3
4 +struct strbuf;
5 +
6 struct name_entry {
7 const struct object_id *oid;
8 const char *path;
unpack-trees.h
+4 -1
@@ -1,11 +1,14 @@
1 #ifndef UNPACK_TREES_H
2 #define UNPACK_TREES_H
3
4 -#include "tree-walk.h"
4 +#include "cache.h"
5 #include "argv-array.h"
6 +#include "string-list.h"
7 +#include "tree-walk.h"
8
9 #define MAX_UNPACK_TREES 8
10
11 +struct cache_entry;
12 struct unpack_trees_options;
13 struct exclude_list;
14
url.h
+2
@@ -1,6 +1,8 @@
1 #ifndef URL_H
2 #define URL_H
3
4 +struct strbuf;
5 +
6 extern int is_url(const char *url);
7 extern int is_urlschemechar(int first_flag, int ch);
8 extern char *url_decode(const char *url);
utf8.h
+2
@@ -1,6 +1,8 @@
1 #ifndef GIT_UTF8_H
2 #define GIT_UTF8_H
3
4 +struct strbuf;
5 +
6 typedef unsigned int ucs_char_t; /* assuming 32bit int */
7
8 size_t display_mode_esc_sequence_len(const char *s);
worktree.h
+1
@@ -1,6 +1,7 @@
1 #ifndef WORKTREE_H
2 #define WORKTREE_H
3
4 +#include "cache.h"
5 #include "refs.h"
6
7 struct strbuf;