{"thread":{"id":"37505","subject":"[RFC PATCH v2 1/2] Makefile: add check-headers target","startedAt":"2014-09-07T00:30:20Z","lastAt":"2014-09-10T17:24:50Z","messageCount":14,"participants":["David Aguilar","René Scharfe","Jonathan Nieder","Johannes Sixt","Junio C Hamano","Matthieu Moy"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"248999","messageId":"1410049821-49861-1-git-send-email-davvid@gmail.com","threadId":"37505","inReplyTo":null,"subject":"[RFC PATCH v2 1/2] Makefile: add check-headers target","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-09-07T00:30:20Z","receivedAt":"2014-09-07T00:30:20Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"This allows us to ensure that each header can be included\nindividually without needing to include other headers first.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nChanges since v1:\nWe now include xdiff, ewah, and vcs-svn headers.\n\n Makefile         |  6 ++++++\n check-headers.sh | 29 +++++++++++++++++++++++++++++\n 2 files changed, 35 insertions(+)\n create mode 100755 check-headers.sh\n\ndiff --git a/Makefile b/Makefile\nindex 30cc622..39ecc70 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2591,6 +2591,12 @@ check-docs::\n check-builtins::\n \t./check-builtins.sh\n \n+### Make sure headers include their dependencies\n+#\n+check-headers::\n+\t./check-headers.sh $(CC) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS)\n+\n+\n ### Test suite coverage testing\n #\n .PHONY: coverage coverage-clean coverage-compile coverage-test coverage-report\ndiff --git a/check-headers.sh b/check-headers.sh\nnew file mode 100755\nindex 0000000..2722dd2\n--- /dev/null\n+++ b/check-headers.sh\n@@ -0,0 +1,29 @@\n+#!/bin/sh\n+\n+exit_code=0\n+\n+maybe_exit () {\n+\tstatus=\"$1\"\n+\tif test \"$status\" != 0\n+\tthen\n+\t\texit_code=\"$status\"\n+\t\tif test -n \"$CHECK_HEADERS_STOP\"\n+\t\tthen\n+\t\t\texit \"$status\"\n+\t\tfi\n+\tfi\n+}\n+\n+IFS='\n+'\n+git ls-files *.h ewah/*.h vcs-svn/*.h xdiff/*.h |\n+while read header\n+do\n+\tsubdir=$(dirname \"$header\") &&\n+\techo \"HEADER $header\" &&\n+\t\"$@\" -Wno-unused -I\"$subdir\" -c -o \"$header\".check -x c - <\"$header\" &&\n+\trm \"$header\".check ||\n+\tmaybe_exit $?\n+done\n+\n+exit $exit_code\n-- \n2.1.0.62.g3e88d26\n"},{"id":"249000","messageId":"1410049821-49861-2-git-send-email-davvid@gmail.com","threadId":"37505","inReplyTo":"1410049821-49861-1-git-send-email-davvid@gmail.com","subject":"[RFC PATCH v2 2/2] headers: include dependent headers","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-09-07T00:30:21Z","receivedAt":"2014-09-07T00:30:21Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Add dependent headers so that including a header does not\nrequire including additional headers.\n\nThis makes it so that \"gcc -c $header\" succeeds for each header.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\nAddresses René's note to not include strbuf.h when cache.h is already\nincluded.\n\n archive.h                | 1 +\n argv-array.h             | 2 ++\n attr.h                   | 2 ++\n branch.h                 | 2 ++\n cache-tree.h             | 1 +\n color.h                  | 3 ++-\n column.h                 | 2 ++\n commit.h                 | 1 +\n compat/bswap.h           | 7 +++++++\n compat/precompose_utf8.h | 8 +++-----\n convert.h                | 3 +++\n credential.h             | 1 +\n csum-file.h              | 2 ++\n delta.h                  | 2 ++\n diff.h                   | 2 +-\n diffcore.h               | 2 ++\n dir.h                    | 2 ++\n ewah/ewok.h              | 2 ++\n ewah/ewok_rlw.h          | 2 ++\n exec_cmd.h               | 2 ++\n fsck.h                   | 2 ++\n gpg-interface.h          | 2 ++\n graph.h                  | 2 ++\n hashmap.h                | 2 ++\n help.h                   | 2 ++\n khash.h                  | 3 +++\n kwset.h                  | 2 ++\n line-log.h               | 1 +\n list-objects.h           | 2 ++\n ll-merge.h               | 2 ++\n mailmap.h                | 3 +++\n merge-recursive.h        | 2 ++\n notes-cache.h            | 1 +\n notes-merge.h            | 3 +++\n notes-utils.h            | 1 +\n notes.h                  | 1 +\n object.h                 | 2 ++\n pack-bitmap.h            | 2 ++\n pack-objects.h           | 2 ++\n pack-revindex.h          | 2 ++\n parse-options.h          | 2 ++\n patch-ids.h              | 3 +++\n pathspec.h               | 2 ++\n progress.h               | 2 ++\n quote.h                  | 3 ++-\n reachable.h              | 2 ++\n reflog-walk.h            | 1 +\n refs.h                   | 4 ++++\n remote.h                 | 1 +\n resolve-undo.h           | 2 ++\n send-pack.h              | 4 ++++\n sequencer.h              | 3 +++\n sha1-lookup.h            | 2 ++\n shortlog.h               | 2 ++\n sideband.h               | 2 ++\n strbuf.h                 | 2 ++\n submodule.h              | 6 ++++--\n tag.h                    | 1 +\n tree-walk.h              | 2 ++\n tree.h                   | 1 +\n unicode_width.h          | 3 +++\n unpack-trees.h           | 2 ++\n url.h                    | 2 ++\n urlmatch.h               | 2 ++\n utf8.c                   | 7 -------\n utf8.h                   | 9 +++++++++\n vcs-svn/fast_export.h    | 5 +++--\n vcs-svn/repo_tree.h      | 3 ++-\n vcs-svn/svndiff.h        | 5 +++--\n wt-status.h              | 1 +\n xdiff/xdiffi.h           | 2 ++\n xdiff/xemit.h            | 1 +\n xdiff/xprepare.h         | 2 ++\n xdiff/xutils.h           | 2 ++\n 74 files changed, 159 insertions(+), 22 deletions(-)\n\ndiff --git a/archive.h b/archive.h\nindex 4a791e1..b2ca5bf 100644\n--- a/archive.h\n+++ b/archive.h\n@@ -1,6 +1,7 @@\n #ifndef ARCHIVE_H\n #define ARCHIVE_H\n \n+#include \"cache.h\"\n #include \"pathspec.h\"\n \n struct archiver_args {\ndiff --git a/argv-array.h b/argv-array.h\nindex c65e6e8..7d877af 100644\n--- a/argv-array.h\n+++ b/argv-array.h\n@@ -1,6 +1,8 @@\n #ifndef ARGV_ARRAY_H\n #define ARGV_ARRAY_H\n \n+#include \"git-compat-util.h\"\n+\n extern const char *empty_argv[];\n \n struct argv_array {\ndiff --git a/attr.h b/attr.h\nindex 8b08d33..34e63f8 100644\n--- a/attr.h\n+++ b/attr.h\n@@ -1,6 +1,8 @@\n #ifndef ATTR_H\n #define ATTR_H\n \n+#include \"cache.h\"\n+\n /* An attribute is a pointer to this opaque structure */\n struct git_attr;\n \ndiff --git a/branch.h b/branch.h\nindex 64173ab..d5fdcc6 100644\n--- a/branch.h\n+++ b/branch.h\n@@ -3,6 +3,8 @@\n \n /* Functions for acting on the information about branches. */\n \n+#include \"cache.h\"\n+\n /*\n  * Creates a new branch, where head is the branch currently checked\n  * out, name is the new branch name, start_name is the name of the\ndiff --git a/cache-tree.h b/cache-tree.h\nindex b47ccec..30b0775 100644\n--- a/cache-tree.h\n+++ b/cache-tree.h\n@@ -3,6 +3,7 @@\n \n #include \"tree.h\"\n #include \"tree-walk.h\"\n+#include \"cache.h\"\n \n struct cache_tree;\n struct cache_tree_sub {\ndiff --git a/color.h b/color.h\nindex 9a8495b..6b50a0f 100644\n--- a/color.h\n+++ b/color.h\n@@ -1,7 +1,8 @@\n #ifndef COLOR_H\n #define COLOR_H\n \n-struct strbuf;\n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n \n /*  2 + (2 * num_attrs) + 8 + 1 + 8 + 'm' + NUL */\n /* \"\\033[1;2;4;5;7;38;5;2xx;48;5;2xxm\\0\" */\ndiff --git a/column.h b/column.h\nindex 0a61917..5d094b4 100644\n--- a/column.h\n+++ b/column.h\n@@ -1,6 +1,8 @@\n #ifndef COLUMN_H\n #define COLUMN_H\n \n+#include \"string-list.h\"\n+\n #define COL_LAYOUT_MASK   0x000F\n #define COL_ENABLE_MASK   0x0030   /* always, never or auto */\n #define COL_PARSEOPT      0x0040   /* --column is given from cmdline */\ndiff --git a/commit.h b/commit.h\nindex aa8c3ca..1fe0731 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -7,6 +7,7 @@\n #include \"decorate.h\"\n #include \"gpg-interface.h\"\n #include \"string-list.h\"\n+#include \"cache.h\"\n \n struct commit_list {\n \tstruct commit *item;\ndiff --git a/compat/bswap.h b/compat/bswap.h\nindex f6fd9a6..0c164be 100644\n--- a/compat/bswap.h\n+++ b/compat/bswap.h\n@@ -1,3 +1,8 @@\n+#ifndef COMPAT_BSWAP_H\n+#define COMPAT_BSWAP_H\n+\n+#include \"git-compat-util.h\"\n+\n /*\n  * Let's make sure we always have a sane definition for ntohl()/htonl().\n  * Some libraries define those as a function call, just to perform byte\n@@ -173,3 +178,5 @@ static inline uint64_t git_bswap64(uint64_t x)\n \t*((unsigned char *)(p) + 3) = __v >>  0; } while (0)\n \n #endif\n+\n+#endif\ndiff --git a/compat/precompose_utf8.h b/compat/precompose_utf8.h\nindex 3b73585..34d1051 100644\n--- a/compat/precompose_utf8.h\n+++ b/compat/precompose_utf8.h\n@@ -1,9 +1,8 @@\n #ifndef PRECOMPOSE_UNICODE_H\n-#include <sys/stat.h>\n-#include <sys/types.h>\n-#include <dirent.h>\n-#include <iconv.h>\n+#define  PRECOMPOSE_UNICODE_H\n \n+#include \"git-compat-util.h\"\n+#include <iconv.h>\n \n typedef struct dirent_prec_psx {\n \tino_t d_ino;            /* Posix */\n@@ -41,5 +40,4 @@ int precompose_utf8_closedir(PREC_DIR *dirp);\n #define DIR PREC_DIR\n #endif /* PRECOMPOSE_UNICODE_C */\n \n-#define  PRECOMPOSE_UNICODE_H\n #endif /* PRECOMPOSE_UNICODE_H */\ndiff --git a/convert.h b/convert.h\nindex 0c2143c..bb3266b 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -4,6 +4,9 @@\n #ifndef CONVERT_H\n #define CONVERT_H\n \n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n+\n enum safe_crlf {\n \tSAFE_CRLF_FALSE = 0,\n \tSAFE_CRLF_FAIL = 1,\ndiff --git a/credential.h b/credential.h\nindex 0c3e85e..cfa87f1 100644\n--- a/credential.h\n+++ b/credential.h\n@@ -1,6 +1,7 @@\n #ifndef CREDENTIAL_H\n #define CREDENTIAL_H\n \n+#include \"git-compat-util.h\"\n #include \"string-list.h\"\n \n struct credential {\ndiff --git a/csum-file.h b/csum-file.h\nindex bb543d5..9e29e35 100644\n--- a/csum-file.h\n+++ b/csum-file.h\n@@ -1,6 +1,8 @@\n #ifndef CSUM_FILE_H\n #define CSUM_FILE_H\n \n+#include \"cache.h\"\n+\n struct progress;\n \n /* A SHA1-protected file */\ndiff --git a/delta.h b/delta.h\nindex 9b67531..668e163 100644\n--- a/delta.h\n+++ b/delta.h\n@@ -1,6 +1,8 @@\n #ifndef DELTA_H\n #define DELTA_H\n \n+#include \"git-compat-util.h\"\n+\n /* opaque object for delta index */\n struct delta_index;\n \ndiff --git a/diff.h b/diff.h\nindex b4a624d..27f7696 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -6,11 +6,11 @@\n \n #include \"tree-walk.h\"\n #include \"pathspec.h\"\n+#include \"strbuf.h\"\n \n struct rev_info;\n struct diff_options;\n struct diff_queue_struct;\n-struct strbuf;\n struct diff_filespec;\n struct userdiff_driver;\n struct sha1_array;\ndiff --git a/diffcore.h b/diffcore.h\nindex c876dac..1f3290c 100644\n--- a/diffcore.h\n+++ b/diffcore.h\n@@ -4,6 +4,8 @@\n #ifndef DIFFCORE_H\n #define DIFFCORE_H\n \n+#include \"diff.h\"\n+\n /* This header file is internal between diff.c and its diff transformers\n  * (e.g. diffcore-rename, diffcore-pickaxe).  Never include this header\n  * in anything else.\ndiff --git a/dir.h b/dir.h\nindex 6c45e9d..727160e 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -4,6 +4,8 @@\n /* See Documentation/technical/api-directory-listing.txt */\n \n #include \"strbuf.h\"\n+#include \"pathspec.h\"\n+#include \"cache.h\"\n \n struct dir_entry {\n \tunsigned int len;\ndiff --git a/ewah/ewok.h b/ewah/ewok.h\nindex f6ad190..7812863 100644\n--- a/ewah/ewok.h\n+++ b/ewah/ewok.h\n@@ -20,6 +20,8 @@\n #ifndef __EWOK_BITMAP_H__\n #define __EWOK_BITMAP_H__\n \n+#include \"git-compat-util.h\"\n+\n #ifndef ewah_malloc\n #\tdefine ewah_malloc xmalloc\n #endif\ndiff --git a/ewah/ewok_rlw.h b/ewah/ewok_rlw.h\nindex 63efdf9..b34dfa1 100644\n--- a/ewah/ewok_rlw.h\n+++ b/ewah/ewok_rlw.h\n@@ -20,6 +20,8 @@\n #ifndef __EWOK_RLW_H__\n #define __EWOK_RLW_H__\n \n+#include \"ewah/ewok.h\"\n+\n #define RLW_RUNNING_BITS (sizeof(eword_t) * 4)\n #define RLW_LITERAL_BITS (sizeof(eword_t) * 8 - 1 - RLW_RUNNING_BITS)\n \ndiff --git a/exec_cmd.h b/exec_cmd.h\nindex e4c9702..daa26e2 100644\n--- a/exec_cmd.h\n+++ b/exec_cmd.h\n@@ -1,6 +1,8 @@\n #ifndef GIT_EXEC_CMD_H\n #define GIT_EXEC_CMD_H\n \n+#include \"git-compat-util.h\"\n+\n extern void git_set_argv_exec_path(const char *exec_path);\n extern const char *git_extract_argv0_path(const char *path);\n extern const char *git_exec_path(void);\ndiff --git a/fsck.h b/fsck.h\nindex 1e4f527..99b2802 100644\n--- a/fsck.h\n+++ b/fsck.h\n@@ -1,6 +1,8 @@\n #ifndef GIT_FSCK_H\n #define GIT_FSCK_H\n \n+#include \"object.h\"\n+\n #define FSCK_ERROR 1\n #define FSCK_WARN 2\n \ndiff --git a/gpg-interface.h b/gpg-interface.h\nindex 37c23da..f42b706 100644\n--- a/gpg-interface.h\n+++ b/gpg-interface.h\n@@ -1,6 +1,8 @@\n #ifndef GPG_INTERFACE_H\n #define GPG_INTERFACE_H\n \n+#include \"strbuf.h\"\n+\n struct signature_check {\n \tchar *payload;\n \tchar *gpg_output;\ndiff --git a/graph.h b/graph.h\nindex 0be62bd..17e6a11 100644\n--- a/graph.h\n+++ b/graph.h\n@@ -1,6 +1,8 @@\n #ifndef GRAPH_H\n #define GRAPH_H\n \n+#include \"revision.h\"\n+\n /* A graph is a pointer to this opaque structure */\n struct git_graph;\n \ndiff --git a/hashmap.h b/hashmap.h\nindex ab7958a..8605fae 100644\n--- a/hashmap.h\n+++ b/hashmap.h\n@@ -1,6 +1,8 @@\n #ifndef HASHMAP_H\n #define HASHMAP_H\n \n+#include \"git-compat-util.h\"\n+\n /*\n  * Generic implementation of hash-based key-value mappings.\n  * See Documentation/technical/api-hashmap.txt.\ndiff --git a/help.h b/help.h\nindex b21d7c9..a3bf882 100644\n--- a/help.h\n+++ b/help.h\n@@ -1,6 +1,8 @@\n #ifndef HELP_H\n #define HELP_H\n \n+#include \"git-compat-util.h\"\n+\n struct cmdnames {\n \tint alloc;\n \tint cnt;\ndiff --git a/khash.h b/khash.h\nindex 06c7906..89f9579 100644\n--- a/khash.h\n+++ b/khash.h\n@@ -26,6 +26,9 @@\n #ifndef __AC_KHASH_H\n #define __AC_KHASH_H\n \n+#include \"git-compat-util.h\"\n+#include \"cache.h\"\n+\n #define AC_VERSION_KHASH_H \"0.2.8\"\n \n typedef uint32_t khint32_t;\ndiff --git a/kwset.h b/kwset.h\nindex a21b2ea..2acc585 100644\n--- a/kwset.h\n+++ b/kwset.h\n@@ -25,6 +25,8 @@\n    The author may be reached (Email) at the address mike@ai.mit.edu,\n    or (US mail) as Mike Haertel c/o Free Software Foundation. */\n \n+#include \"git-compat-util.h\"\n+\n struct kwsmatch\n {\n   int index;\t\t\t/* Index number of matching keyword. */\ndiff --git a/line-log.h b/line-log.h\nindex a9212d8..e1d47e0 100644\n--- a/line-log.h\n+++ b/line-log.h\n@@ -2,6 +2,7 @@\n #define LINE_LOG_H\n \n #include \"diffcore.h\"\n+#include \"string-list.h\"\n \n struct rev_info;\n struct commit;\ndiff --git a/list-objects.h b/list-objects.h\nindex 136a1da..8810db6 100644\n--- a/list-objects.h\n+++ b/list-objects.h\n@@ -1,6 +1,8 @@\n #ifndef LIST_OBJECTS_H\n #define LIST_OBJECTS_H\n \n+#include \"revision.h\"\n+\n typedef void (*show_commit_fn)(struct commit *, void *);\n typedef void (*show_object_fn)(struct object *, const struct name_path *, const char *, void *);\n void traverse_commit_list(struct rev_info *, show_commit_fn, show_object_fn, void *);\ndiff --git a/ll-merge.h b/ll-merge.h\nindex 244a31f..b72b199 100644\n--- a/ll-merge.h\n+++ b/ll-merge.h\n@@ -5,6 +5,8 @@\n #ifndef LL_MERGE_H\n #define LL_MERGE_H\n \n+#include \"xdiff/xdiff.h\"\n+\n struct ll_merge_options {\n \tunsigned virtual_ancestor : 1;\n \tunsigned variant : 2;\t/* favor ours, favor theirs, or union merge */\ndiff --git a/mailmap.h b/mailmap.h\nindex ed7c93b..27ac3c7 100644\n--- a/mailmap.h\n+++ b/mailmap.h\n@@ -1,6 +1,9 @@\n #ifndef MAILMAP_H\n #define MAILMAP_H\n \n+#include \"git-compat-util.h\"\n+#include \"string-list.h\"\n+\n int read_mailmap(struct string_list *map, char **repo_abbrev);\n void clear_mailmap(struct string_list *map);\n \ndiff --git a/merge-recursive.h b/merge-recursive.h\nindex 9e090a3..05500b3 100644\n--- a/merge-recursive.h\n+++ b/merge-recursive.h\n@@ -1,7 +1,9 @@\n #ifndef MERGE_RECURSIVE_H\n #define MERGE_RECURSIVE_H\n \n+#include \"strbuf.h\"\n #include \"string-list.h\"\n+#include \"commit.h\"\n \n struct merge_options {\n \tconst char *ancestor;\ndiff --git a/notes-cache.h b/notes-cache.h\nindex 356f88f..4ecd767 100644\n--- a/notes-cache.h\n+++ b/notes-cache.h\n@@ -1,6 +1,7 @@\n #ifndef NOTES_CACHE_H\n #define NOTES_CACHE_H\n \n+#include \"git-compat-util.h\"\n #include \"notes.h\"\n \n struct notes_cache {\ndiff --git a/notes-merge.h b/notes-merge.h\nindex 1d01f6a..73d961d 100644\n--- a/notes-merge.h\n+++ b/notes-merge.h\n@@ -1,6 +1,9 @@\n #ifndef NOTES_MERGE_H\n #define NOTES_MERGE_H\n \n+#include \"notes.h\"\n+#include \"commit.h\"\n+\n #define NOTES_MERGE_WORKTREE \"NOTES_MERGE_WORKTREE\"\n \n enum notes_merge_verbosity {\ndiff --git a/notes-utils.h b/notes-utils.h\nindex 890ddb3..eaac967 100644\n--- a/notes-utils.h\n+++ b/notes-utils.h\n@@ -2,6 +2,7 @@\n #define NOTES_UTILS_H\n \n #include \"notes.h\"\n+#include \"commit.h\"\n \n /*\n  * Create new notes commit from the given notes tree\ndiff --git a/notes.h b/notes.h\nindex 2a3f923..12318a4 100644\n--- a/notes.h\n+++ b/notes.h\n@@ -1,6 +1,7 @@\n #ifndef NOTES_H\n #define NOTES_H\n \n+#include \"strbuf.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/object.h b/object.h\nindex 5e8d8ee..e61b290 100644\n--- a/object.h\n+++ b/object.h\n@@ -1,6 +1,8 @@\n #ifndef OBJECT_H\n #define OBJECT_H\n \n+#include \"cache.h\"\n+\n struct object_list {\n \tstruct object *item;\n \tstruct object_list *next;\ndiff --git a/pack-bitmap.h b/pack-bitmap.h\nindex 8b7f4e9..945ff30 100644\n--- a/pack-bitmap.h\n+++ b/pack-bitmap.h\n@@ -1,9 +1,11 @@\n #ifndef PACK_BITMAP_H\n #define PACK_BITMAP_H\n \n+#include \"git-compat-util.h\"\n #include \"ewah/ewok.h\"\n #include \"khash.h\"\n #include \"pack-objects.h\"\n+#include \"revision.h\"\n \n struct bitmap_disk_entry {\n \tuint32_t object_pos;\ndiff --git a/pack-objects.h b/pack-objects.h\nindex d1b98b3..2c28bea 100644\n--- a/pack-objects.h\n+++ b/pack-objects.h\n@@ -1,6 +1,8 @@\n #ifndef PACK_OBJECTS_H\n #define PACK_OBJECTS_H\n \n+#include \"pack.h\"\n+\n struct object_entry {\n \tstruct pack_idx_entry idx;\n \tunsigned long size;\t/* uncompressed size */\ndiff --git a/pack-revindex.h b/pack-revindex.h\nindex d737f98..4e574b3 100644\n--- a/pack-revindex.h\n+++ b/pack-revindex.h\n@@ -1,6 +1,8 @@\n #ifndef PACK_REVINDEX_H\n #define PACK_REVINDEX_H\n \n+#include \"git-compat-util.h\"\n+\n struct revindex_entry {\n \toff_t offset;\n \tunsigned int nr;\ndiff --git a/parse-options.h b/parse-options.h\nindex 7940bc7..933a1b7 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -1,6 +1,8 @@\n #ifndef PARSE_OPTIONS_H\n #define PARSE_OPTIONS_H\n \n+#include \"git-compat-util.h\"\n+\n enum parse_opt_type {\n \t/* special types */\n \tOPTION_END,\ndiff --git a/patch-ids.h b/patch-ids.h\nindex c8c7ca1..016eb2d 100644\n--- a/patch-ids.h\n+++ b/patch-ids.h\n@@ -1,6 +1,9 @@\n #ifndef PATCH_IDS_H\n #define PATCH_IDS_H\n \n+#include \"commit.h\"\n+#include \"diff.h\"\n+\n struct patch_id {\n \tunsigned char patch_id[20];\n \tchar seen;\ndiff --git a/pathspec.h b/pathspec.h\nindex 0c11262..c92fafc 100644\n--- a/pathspec.h\n+++ b/pathspec.h\n@@ -1,6 +1,8 @@\n #ifndef PATHSPEC_H\n #define PATHSPEC_H\n \n+#include \"git-compat-util.h\"\n+\n /* Pathspec magic */\n #define PATHSPEC_FROMTOP\t(1<<0)\n #define PATHSPEC_MAXDEPTH\t(1<<1)\ndiff --git a/progress.h b/progress.h\nindex 611e4c4..4c78a2c 100644\n--- a/progress.h\n+++ b/progress.h\n@@ -1,6 +1,8 @@\n #ifndef PROGRESS_H\n #define PROGRESS_H\n \n+#include \"git-compat-util.h\"\n+\n struct progress;\n \n void display_throughput(struct progress *progress, off_t total);\ndiff --git a/quote.h b/quote.h\nindex 71dcc3a..37f857b 100644\n--- a/quote.h\n+++ b/quote.h\n@@ -1,7 +1,8 @@\n #ifndef QUOTE_H\n #define QUOTE_H\n \n-struct strbuf;\n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n \n /* Help to copy the thing properly quoted for the shell safety.\n  * any single quote is replaced with '\\'', any exclamation point\ndiff --git a/reachable.h b/reachable.h\nindex 5d082ad..5536382 100644\n--- a/reachable.h\n+++ b/reachable.h\n@@ -1,6 +1,8 @@\n #ifndef REACHEABLE_H\n #define REACHEABLE_H\n \n+#include \"revision.h\"\n+\n struct progress;\n extern void mark_reachable_objects(struct rev_info *revs, int mark_reflog, struct progress *);\n \ndiff --git a/reflog-walk.h b/reflog-walk.h\nindex 50265f5..d5378b9 100644\n--- a/reflog-walk.h\n+++ b/reflog-walk.h\n@@ -2,6 +2,7 @@\n #define REFLOG_WALK_H\n \n #include \"cache.h\"\n+#include \"commit.h\"\n \n struct reflog_walk_info;\n \ndiff --git a/refs.h b/refs.h\nindex ec46acd..5c43232 100644\n--- a/refs.h\n+++ b/refs.h\n@@ -1,6 +1,10 @@\n #ifndef REFS_H\n #define REFS_H\n \n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n+#include \"string-list.h\"\n+\n struct ref_lock {\n \tchar *ref_name;\n \tchar *orig_ref_name;\ndiff --git a/remote.h b/remote.h\nindex 8b62efd..24bcbd7 100644\n--- a/remote.h\n+++ b/remote.h\n@@ -3,6 +3,7 @@\n \n #include \"parse-options.h\"\n #include \"hashmap.h\"\n+#include \"strbuf.h\"\n \n enum {\n \tREMOTE_CONFIG,\ndiff --git a/resolve-undo.h b/resolve-undo.h\nindex 4630645..815050d 100644\n--- a/resolve-undo.h\n+++ b/resolve-undo.h\n@@ -1,6 +1,8 @@\n #ifndef RESOLVE_UNDO_H\n #define RESOLVE_UNDO_H\n \n+#include \"cache.h\"\n+\n struct resolve_undo_info {\n \tunsigned int mode[3];\n \tunsigned char sha1[3][20];\ndiff --git a/send-pack.h b/send-pack.h\nindex 8e84392..f0c463a 100644\n--- a/send-pack.h\n+++ b/send-pack.h\n@@ -1,6 +1,10 @@\n #ifndef SEND_PACK_H\n #define SEND_PACK_H\n \n+#include \"git-compat-util.h\"\n+#include \"run-command.h\"\n+#include \"remote.h\"\n+\n struct send_pack_args {\n \tunsigned verbose:1,\n \t\tquiet:1,\ndiff --git a/sequencer.h b/sequencer.h\nindex db43e9c..c817247 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -1,6 +1,9 @@\n #ifndef SEQUENCER_H\n #define SEQUENCER_H\n \n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n+\n #define SEQ_DIR\t\t\"sequencer\"\n #define SEQ_HEAD_FILE\t\"sequencer/head\"\n #define SEQ_TODO_FILE\t\"sequencer/todo\"\ndiff --git a/sha1-lookup.h b/sha1-lookup.h\nindex 20af285..f375596 100644\n--- a/sha1-lookup.h\n+++ b/sha1-lookup.h\n@@ -1,6 +1,8 @@\n #ifndef SHA1_LOOKUP_H\n #define SHA1_LOOKUP_H\n \n+#include \"git-compat-util.h\"\n+\n typedef const unsigned char *sha1_access_fn(size_t index, void *table);\n \n extern int sha1_pos(const unsigned char *sha1,\ndiff --git a/shortlog.h b/shortlog.h\nindex de4f86f..e5949e7 100644\n--- a/shortlog.h\n+++ b/shortlog.h\n@@ -1,6 +1,8 @@\n #ifndef SHORTLOG_H\n #define SHORTLOG_H\n \n+#include \"git-compat-util.h\"\n+#include \"commit.h\"\n #include \"string-list.h\"\n \n struct shortlog {\ndiff --git a/sideband.h b/sideband.h\nindex e46bed0..411aa51 100644\n--- a/sideband.h\n+++ b/sideband.h\n@@ -1,6 +1,8 @@\n #ifndef SIDEBAND_H\n #define SIDEBAND_H\n \n+#include \"git-compat-util.h\"\n+\n #define SIDEBAND_PROTOCOL_ERROR -2\n #define SIDEBAND_REMOTE_ERROR -1\n \ndiff --git a/strbuf.h b/strbuf.h\nindex 7bdc1da..c3ea9a2 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -1,6 +1,8 @@\n #ifndef STRBUF_H\n #define STRBUF_H\n \n+#include \"git-compat-util.h\"\n+\n /* See Documentation/technical/api-strbuf.txt */\n \n extern char strbuf_slopbuf[];\ndiff --git a/submodule.h b/submodule.h\nindex 7beec48..52bb673 100644\n--- a/submodule.h\n+++ b/submodule.h\n@@ -1,8 +1,10 @@\n #ifndef SUBMODULE_H\n #define SUBMODULE_H\n \n-struct diff_options;\n-struct argv_array;\n+#include \"git-compat-util.h\"\n+#include \"diff.h\"\n+#include \"argv-array.h\"\n+#include \"string-list.h\"\n \n enum {\n \tRECURSE_SUBMODULES_ON_DEMAND = -1,\ndiff --git a/tag.h b/tag.h\nindex bc8a1e4..68b0334 100644\n--- a/tag.h\n+++ b/tag.h\n@@ -1,6 +1,7 @@\n #ifndef TAG_H\n #define TAG_H\n \n+#include \"git-compat-util.h\"\n #include \"object.h\"\n \n extern const char *tag_type;\ndiff --git a/tree-walk.h b/tree-walk.h\nindex ae7fb3a..0818126 100644\n--- a/tree-walk.h\n+++ b/tree-walk.h\n@@ -1,6 +1,8 @@\n #ifndef TREE_WALK_H\n #define TREE_WALK_H\n \n+#include \"strbuf.h\"\n+\n struct name_entry {\n \tconst unsigned char *sha1;\n \tconst char *path;\ndiff --git a/tree.h b/tree.h\nindex d84ac63..9565406 100644\n--- a/tree.h\n+++ b/tree.h\n@@ -2,6 +2,7 @@\n #define TREE_H\n \n #include \"object.h\"\n+#include \"pathspec.h\"\n \n extern const char *tree_type;\n \ndiff --git a/unicode_width.h b/unicode_width.h\nindex 47cdd23..b35bdc4 100644\n--- a/unicode_width.h\n+++ b/unicode_width.h\n@@ -1,3 +1,6 @@\n+#include \"git-compat-util.h\"\n+#include \"utf8.h\"\n+\n static const struct interval zero_width[] = {\n { 0x0300, 0x036F },\n { 0x0483, 0x0489 },\ndiff --git a/unpack-trees.h b/unpack-trees.h\nindex 36a73a6..e4792ec 100644\n--- a/unpack-trees.h\n+++ b/unpack-trees.h\n@@ -1,7 +1,9 @@\n #ifndef UNPACK_TREES_H\n #define UNPACK_TREES_H\n \n+#include \"cache.h\"\n #include \"string-list.h\"\n+#include \"tree-walk.h\"\n \n #define MAX_UNPACK_TREES 8\n \ndiff --git a/url.h b/url.h\nindex abdaf6f..f4a23c3 100644\n--- a/url.h\n+++ b/url.h\n@@ -1,6 +1,8 @@\n #ifndef URL_H\n #define URL_H\n \n+#include \"strbuf.h\"\n+\n extern int is_url(const char *url);\n extern int is_urlschemechar(int first_flag, int ch);\n extern char *url_decode(const char *url);\ndiff --git a/urlmatch.h b/urlmatch.h\nindex b461dfd..9f7c781 100644\n--- a/urlmatch.h\n+++ b/urlmatch.h\n@@ -1,4 +1,6 @@\n #ifndef URL_MATCH_H\n+\n+#include \"git-compat-util.h\"\n #include \"string-list.h\"\n \n struct url_info {\ndiff --git a/utf8.c b/utf8.c\nindex b30790d..fb9f299 100644\n--- a/utf8.c\n+++ b/utf8.c\n@@ -2,13 +2,6 @@\n #include \"strbuf.h\"\n #include \"utf8.h\"\n \n-/* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */\n-\n-struct interval {\n-\tucs_char_t first;\n-\tucs_char_t last;\n-};\n-\n size_t display_mode_esc_sequence_len(const char *s)\n {\n \tconst char *p = s;\ndiff --git a/utf8.h b/utf8.h\nindex 65d0e42..af855c5 100644\n--- a/utf8.h\n+++ b/utf8.h\n@@ -1,8 +1,17 @@\n #ifndef GIT_UTF8_H\n #define GIT_UTF8_H\n \n+#include \"strbuf.h\"\n+\n typedef unsigned int ucs_char_t;  /* assuming 32bit int */\n \n+/* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */\n+\n+struct interval {\n+\tucs_char_t first;\n+\tucs_char_t last;\n+};\n+\n size_t display_mode_esc_sequence_len(const char *s);\n int utf8_width(const char **start, size_t *remainder_p);\n int utf8_strnwidth(const char *string, int len, int skip_ansi);\ndiff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h\nindex c8b5adb..7fd5364 100644\n--- a/vcs-svn/fast_export.h\n+++ b/vcs-svn/fast_export.h\n@@ -1,8 +1,9 @@\n #ifndef FAST_EXPORT_H_\n #define FAST_EXPORT_H_\n \n-struct strbuf;\n-struct line_buffer;\n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n+#include \"vcs-svn/line_buffer.h\"\n \n void fast_export_init(int fd);\n void fast_export_deinit(void);\ndiff --git a/vcs-svn/repo_tree.h b/vcs-svn/repo_tree.h\nindex 889c6a3..3a946f7 100644\n--- a/vcs-svn/repo_tree.h\n+++ b/vcs-svn/repo_tree.h\n@@ -1,7 +1,8 @@\n #ifndef REPO_TREE_H_\n #define REPO_TREE_H_\n \n-struct strbuf;\n+#include \"git-compat-util.h\"\n+#include \"strbuf.h\"\n \n #define REPO_MODE_DIR 0040000\n #define REPO_MODE_BLB 0100644\ndiff --git a/vcs-svn/svndiff.h b/vcs-svn/svndiff.h\nindex 74eb464..d0cbd51 100644\n--- a/vcs-svn/svndiff.h\n+++ b/vcs-svn/svndiff.h\n@@ -1,8 +1,9 @@\n #ifndef SVNDIFF_H_\n #define SVNDIFF_H_\n \n-struct line_buffer;\n-struct sliding_view;\n+#include \"git-compat-util.h\"\n+#include \"vcs-svn/line_buffer.h\"\n+#include \"vcs-svn/sliding_window.h\"\n \n extern int svndiff0_apply(struct line_buffer *delta, off_t delta_len,\n \t\tstruct sliding_view *preimage, FILE *postimage);\ndiff --git a/wt-status.h b/wt-status.h\nindex 283a9fe..38f930a 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -4,6 +4,7 @@\n #include <stdio.h>\n #include \"string-list.h\"\n #include \"color.h\"\n+#include \"pathspec.h\"\n \n enum color_wt_status {\n \tWT_STATUS_HEADER = 0,\ndiff --git a/xdiff/xdiffi.h b/xdiff/xdiffi.h\nindex 8b81206..d1f0e1d 100644\n--- a/xdiff/xdiffi.h\n+++ b/xdiff/xdiffi.h\n@@ -23,6 +23,8 @@\n #if !defined(XDIFFI_H)\n #define XDIFFI_H\n \n+#include \"xdiff.h\"\n+#include \"xtypes.h\"\n \n typedef struct s_diffdata {\n \tlong nrec;\ndiff --git a/xdiff/xemit.h b/xdiff/xemit.h\nindex d297107..ad719ad 100644\n--- a/xdiff/xemit.h\n+++ b/xdiff/xemit.h\n@@ -23,6 +23,7 @@\n #if !defined(XEMIT_H)\n #define XEMIT_H\n \n+#include \"xdiffi.h\"\n \n typedef int (*emit_func_t)(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,\n \t\t\t   xdemitconf_t const *xecfg);\ndiff --git a/xdiff/xprepare.h b/xdiff/xprepare.h\nindex 8fb06a5..a2958cf 100644\n--- a/xdiff/xprepare.h\n+++ b/xdiff/xprepare.h\n@@ -23,6 +23,8 @@\n #if !defined(XPREPARE_H)\n #define XPREPARE_H\n \n+#include \"xdiff.h\"\n+#include \"xtypes.h\"\n \n \n int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,\ndiff --git a/xdiff/xutils.h b/xdiff/xutils.h\nindex 4646ce5..a55237b 100644\n--- a/xdiff/xutils.h\n+++ b/xdiff/xutils.h\n@@ -23,6 +23,8 @@\n #if !defined(XUTILS_H)\n #define XUTILS_H\n \n+#include \"xdiff.h\"\n+#include \"xtypes.h\"\n \n \n long xdl_bogosqrt(long n);\n-- \n2.1.0.62.g3e88d26\n"},{"id":"249001","messageId":"540BFE2C.6060409@web.de","threadId":"37505","inReplyTo":"1410049821-49861-2-git-send-email-davvid@gmail.com","subject":"Re: [RFC PATCH v2 2/2] headers: include dependent headers","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2014-09-07T06:41:48Z","receivedAt":"2014-09-07T06:41:48Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 07.09.2014 um 02:30 schrieb David Aguilar:\n> Add dependent headers so that including a header does not\n> require including additional headers.\n> \n> This makes it so that \"gcc -c $header\" succeeds for each header.\n> \n> Signed-off-by: David Aguilar <davvid@gmail.com>\n> ---\n> Addresses René's note to not include strbuf.h when cache.h is already\n> included.\n\nPerhaps squash this in in order to catch two more cases and also\navoid including git-compat-util.h if we already have cache.h:\n\ndiff --git a/builtin.h b/builtin.h\nindex df40fce..0419af3 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -1,7 +1,6 @@\n #ifndef BUILTIN_H\n #define BUILTIN_H\n \n-#include \"git-compat-util.h\"\n #include \"cache.h\"\n #include \"commit.h\"\n \ndiff --git a/commit.h b/commit.h\nindex 1fe0731..dddc876 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -3,7 +3,6 @@\n \n #include \"object.h\"\n #include \"tree.h\"\n-#include \"strbuf.h\"\n #include \"decorate.h\"\n #include \"gpg-interface.h\"\n #include \"string-list.h\"\ndiff --git a/dir.h b/dir.h\nindex 727160e..6b00001 100644\n--- a/dir.h\n+++ b/dir.h\n@@ -3,7 +3,6 @@\n \n /* See Documentation/technical/api-directory-listing.txt */\n \n-#include \"strbuf.h\"\n #include \"pathspec.h\"\n #include \"cache.h\"\n \ndiff --git a/khash.h b/khash.h\nindex 89f9579..fc8b1bf 100644\n--- a/khash.h\n+++ b/khash.h\n@@ -26,7 +26,6 @@\n #ifndef __AC_KHASH_H\n #define __AC_KHASH_H\n \n-#include \"git-compat-util.h\"\n #include \"cache.h\"\n \n #define AC_VERSION_KHASH_H \"0.2.8\"\n"},{"id":"249013","messageId":"20140907194227.GA1611@google.com","threadId":"37505","inReplyTo":"1410049821-49861-1-git-send-email-davvid@gmail.com","subject":"Re: [RFC PATCH v2 1/2] Makefile: add check-headers target","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-09-07T19:42:27Z","receivedAt":"2014-09-07T19:42:27Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nDavid Aguilar wrote:\n\n> --- /dev/null\n> +++ b/check-headers.sh\n> @@ -0,0 +1,29 @@\n[...]\n> +\t\"$@\" -Wno-unused -I\"$subdir\" -c -o \"$header\".check -x c - <\"$header\" &&\n\nAll .c files in git are supposed to start by #include-ing\ngit-compat-util.h, cache.h, or builtin.h to set the appropriate\nfeature test macros and include system headers.\n\nHeaders rely on that for basic types like int32_t.  They don't need to\ninclude git-compat-util.h because the .c file that included them would\nhave already, and .h files #include-ed by git-compat-util.h especially\n*shouldn't* #include the compat header, so how about something like\nthe following for squashing in?\n\nA side-thought: as long as we're building pre-compiled headers, could\nwe use them in the build?\n\nThanks,\nJonathan\n\ndiff --git a/check-headers.sh b/check-headers.sh\nindex bf85c41..08ca136 100755\n--- a/check-headers.sh\n+++ b/check-headers.sh\n@@ -18,7 +18,7 @@ git ls-files *.h |\n while read header\n do\n \techo \"HEADER $header\" &&\n-\t\"$@\" -Wno-unused -x c -c -o \"$header\".bin - <\"$header\" &&\n+\t\"$@\" -Wno-unused -x c -include git-compat-util.h -c -o \"$header\".bin - <\"$header\" &&\n \trm \"$header\".bin ||\n \tmaybe_exit $?\n done\n"},{"id":"249014","messageId":"20140907194917.GB1611@google.com","threadId":"37505","inReplyTo":"1410049821-49861-2-git-send-email-davvid@gmail.com","subject":"Re: [RFC PATCH v2 2/2] headers: include dependent headers","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-09-07T19:49:18Z","receivedAt":"2014-09-07T19:49:18Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"David Aguilar wrote:\n\n> Add dependent headers so that including a header does not\n> require including additional headers.\n\nI agree with this goal, modulo the compat-util.h caveat.  Thanks\nfor working on it.\n\n[...]\n> --- a/archive.h\n> +++ b/archive.h\n> @@ -1,6 +1,7 @@\n>  #ifndef ARCHIVE_H\n>  #define ARCHIVE_H\n>  \n> +#include \"cache.h\"\n>  #include \"pathspec.h\"\n>  \n>  struct archiver_args {\n\nI'm less happy about the way of achieving that goal.  Here's an\nalternative.  Advantages:\n\n * (fully expanded) headers stay small\n\n * fewer other headers included as a side-effect of including one\n   header, so callers are more likely to remember to #include the\n   headers defining things they need (which makes later refactoring\n   easier)\n\n * circular header dependencies are harder to produce\n\nIf this seems like a good direction to go in, I can finish the patch\nlater today (or I don't mind if someone else takes care of it).  This\nis just to give the idea --- I stopped at dir.h.\n\nSensible?\nJonathan\n\ndiff --git i/archive.h w/archive.h\nindex 4a791e1..11f4d42 100644\n--- i/archive.h\n+++ w/archive.h\n@@ -3,6 +3,9 @@\n \n #include \"pathspec.h\"\n \n+enum object_type;\n+\n+\n struct archiver_args {\n \tconst char *base;\n \tsize_t baselen;\ndiff --git i/attr.h w/attr.h\nindex 8b08d33..c971ef2 100644\n--- i/attr.h\n+++ w/attr.h\n@@ -1,6 +1,8 @@\n #ifndef ATTR_H\n #define ATTR_H\n \n+struct index_state;\n+\n /* An attribute is a pointer to this opaque structure */\n struct git_attr;\n \ndiff --git i/branch.h w/branch.h\nindex 64173ab..ed63209 100644\n--- i/branch.h\n+++ w/branch.h\n@@ -1,6 +1,9 @@\n #ifndef BRANCH_H\n #define BRANCH_H\n \n+enum branch_track;\n+struct strbuf;\n+\n /* Functions for acting on the information about branches. */\n \n /*\ndiff --git i/cache-tree.h w/cache-tree.h\nindex b47ccec..c22e2ec 100644\n--- i/cache-tree.h\n+++ w/cache-tree.h\n@@ -1,8 +1,12 @@\n #ifndef CACHE_TREE_H\n #define CACHE_TREE_H\n \n-#include \"tree.h\"\n-#include \"tree-walk.h\"\n+struct traverse_info;\n+struct index_state;\n+struct name_entry;\n+struct tree;\n+struct string_list;\n+struct strbuf;\n \n struct cache_tree;\n struct cache_tree_sub {\ndiff --git i/column.h w/column.h\nindex 0a61917..8211386 100644\n--- i/column.h\n+++ w/column.h\n@@ -1,6 +1,9 @@\n #ifndef COLUMN_H\n #define COLUMN_H\n \n+struct option;\n+struct string_list;\n+\n #define COL_LAYOUT_MASK   0x000F\n #define COL_ENABLE_MASK   0x0030   /* always, never or auto */\n #define COL_PARSEOPT      0x0040   /* --column is given from cmdline */\n@@ -26,7 +29,6 @@ struct column_options {\n \tconst char *nl;\n };\n \n-struct option;\n extern int parseopt_column_callback(const struct option *, const char *, int);\n extern int git_column_config(const char *var, const char *value,\n \t\t\t     const char *command, unsigned int *colopts);\ndiff --git i/commit.h w/commit.h\nindex aa8c3ca..d2fd182 100644\n--- i/commit.h\n+++ w/commit.h\n@@ -1,13 +1,18 @@\n #ifndef COMMIT_H\n #define COMMIT_H\n \n+#include \"cache.h\"\n #include \"object.h\"\n-#include \"tree.h\"\n-#include \"strbuf.h\"\n-#include \"decorate.h\"\n-#include \"gpg-interface.h\"\n+#include \"trace.h\"\n #include \"string-list.h\"\n \n+struct reflog_walk_info;\n+struct rev_info;\n+struct ref;\n+struct signature_check;\n+struct sha1_array;\n+struct strbuf;\n+\n struct commit_list {\n \tstruct commit *item;\n \tstruct commit_list *next;\n@@ -151,7 +156,6 @@ struct userformat_want {\n };\n \n extern int has_non_ascii(const char *text);\n-struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */\n extern const char *logmsg_reencode(const struct commit *commit,\n \t\t\t\t   char **commit_encoding,\n \t\t\t\t   const char *output_encoding);\n@@ -231,8 +235,6 @@ extern struct commit_list *get_octopus_merge_bases(struct commit_list *in);\n /* largest positive number a signed 32-bit integer can contain */\n #define INFINITE_DEPTH 0x7fffffff\n \n-struct sha1_array;\n-struct ref;\n extern int register_shallow(const unsigned char *sha1);\n extern int unregister_shallow(const unsigned char *sha1);\n extern int for_each_commit_graft(each_commit_graft_fn, void *);\ndiff --git i/convert.h w/convert.h\nindex 0c2143c..e623527 100644\n--- i/convert.h\n+++ w/convert.h\n@@ -4,6 +4,8 @@\n #ifndef CONVERT_H\n #define CONVERT_H\n \n+struct strbuf;\n+\n enum safe_crlf {\n \tSAFE_CRLF_FALSE = 0,\n \tSAFE_CRLF_FAIL = 1,\ndiff --git i/csum-file.h w/csum-file.h\nindex bb543d5..9e29e35 100644\n--- i/csum-file.h\n+++ w/csum-file.h\n@@ -1,6 +1,8 @@\n #ifndef CSUM_FILE_H\n #define CSUM_FILE_H\n \n+#include \"cache.h\"\n+\n struct progress;\n \n /* A SHA1-protected file */\ndiff --git i/diffcore.h w/diffcore.h\nindex c876dac..96fc827 100644\n--- i/diffcore.h\n+++ w/diffcore.h\n@@ -4,6 +4,9 @@\n #ifndef DIFFCORE_H\n #define DIFFCORE_H\n \n+struct userdiff_driver;\n+struct diff_options;\n+\n /* This header file is internal between diff.c and its diff transformers\n  * (e.g. diffcore-rename, diffcore-pickaxe).  Never include this header\n  * in anything else.\n@@ -22,8 +25,6 @@\n \n #define MINIMUM_BREAK_SIZE     400 /* do not break a file smaller than this */\n \n-struct userdiff_driver;\n-\n struct diff_filespec {\n \tunsigned char sha1[20];\n \tchar *path;\ndiff --git i/object.h w/object.h\nindex 5e8d8ee..40bd3a8 100644\n--- i/object.h\n+++ w/object.h\n@@ -1,6 +1,8 @@\n #ifndef OBJECT_H\n #define OBJECT_H\n \n+enum object_type;\n+\n struct object_list {\n \tstruct object *item;\n \tstruct object_list *next;\ndiff --git i/tree-walk.h w/tree-walk.h\nindex ae7fb3a..d7612cf 100644\n--- i/tree-walk.h\n+++ w/tree-walk.h\n@@ -1,6 +1,8 @@\n #ifndef TREE_WALK_H\n #define TREE_WALK_H\n \n+struct strbuf;\n+\n struct name_entry {\n \tconst unsigned char *sha1;\n \tconst char *path;\ndiff --git i/tree.h w/tree.h\nindex d84ac63..ef84153 100644\n--- i/tree.h\n+++ w/tree.h\n@@ -3,6 +3,9 @@\n \n #include \"object.h\"\n \n+struct pathspec;\n+\n+\n extern const char *tree_type;\n \n struct tree {\n"},{"id":"249015","messageId":"540CB7EA.1000303@kdbg.org","threadId":"37505","inReplyTo":"20140907194917.GB1611@google.com","subject":"Re: [RFC PATCH v2 2/2] headers: include dependent headers","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2014-09-07T19:54:18Z","receivedAt":"2014-09-07T19:54:18Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 07.09.2014 21:49, schrieb Jonathan Nieder:\n> +enum object_type;\n\nEnum forward declarations are a relatively new C feature. They certainly\ndon't exist pre-C99.\n\n-- Hannes\n"},{"id":"249016","messageId":"20140907200133.GA8201@google.com","threadId":"37505","inReplyTo":"540CB7EA.1000303@kdbg.org","subject":"Re: [RFC PATCH v2 2/2] headers: include dependent headers","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-09-07T20:01:33Z","receivedAt":"2014-09-07T20:01:33Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Johannes Sixt wrote:\n> Am 07.09.2014 21:49, schrieb Jonathan Nieder:\n\n>> +enum object_type;\n>\n> Enum forward declarations are a relatively new C feature. They certainly\n> don't exist pre-C99.\n\nGood catch.  That makes\n\ndiff --git i/archive.h w/archive.h\nindex 4a791e1..b2ca5bf 100644\n--- i/archive.h\n+++ w/archive.h\n@@ -1,6 +1,7 @@\n #ifndef ARCHIVE_H\n #define ARCHIVE_H\n \n+#include \"cache.h\"\n #include \"pathspec.h\"\n \n struct archiver_args {\ndiff --git i/attr.h w/attr.h\nindex 8b08d33..c971ef2 100644\n--- i/attr.h\n+++ w/attr.h\n@@ -1,6 +1,8 @@\n #ifndef ATTR_H\n #define ATTR_H\n \n+struct index_state;\n+\n /* An attribute is a pointer to this opaque structure */\n struct git_attr;\n \ndiff --git i/branch.h w/branch.h\nindex 64173ab..5ce6e21 100644\n--- i/branch.h\n+++ w/branch.h\n@@ -1,6 +1,8 @@\n #ifndef BRANCH_H\n #define BRANCH_H\n \n+#include \"cache.h\"\n+\n /* Functions for acting on the information about branches. */\n \n /*\ndiff --git i/cache-tree.h w/cache-tree.h\nindex b47ccec..c22e2ec 100644\n--- i/cache-tree.h\n+++ w/cache-tree.h\n@@ -1,8 +1,12 @@\n #ifndef CACHE_TREE_H\n #define CACHE_TREE_H\n \n-#include \"tree.h\"\n-#include \"tree-walk.h\"\n+struct traverse_info;\n+struct index_state;\n+struct name_entry;\n+struct tree;\n+struct string_list;\n+struct strbuf;\n \n struct cache_tree;\n struct cache_tree_sub {\ndiff --git i/column.h w/column.h\nindex 0a61917..8211386 100644\n--- i/column.h\n+++ w/column.h\n@@ -1,6 +1,9 @@\n #ifndef COLUMN_H\n #define COLUMN_H\n \n+struct option;\n+struct string_list;\n+\n #define COL_LAYOUT_MASK   0x000F\n #define COL_ENABLE_MASK   0x0030   /* always, never or auto */\n #define COL_PARSEOPT      0x0040   /* --column is given from cmdline */\n@@ -26,7 +29,6 @@ struct column_options {\n \tconst char *nl;\n };\n \n-struct option;\n extern int parseopt_column_callback(const struct option *, const char *, int);\n extern int git_column_config(const char *var, const char *value,\n \t\t\t     const char *command, unsigned int *colopts);\ndiff --git i/commit.h w/commit.h\nindex aa8c3ca..097fc9e 100644\n--- i/commit.h\n+++ w/commit.h\n@@ -1,13 +1,17 @@\n #ifndef COMMIT_H\n #define COMMIT_H\n \n+#include \"cache.h\"\n #include \"object.h\"\n-#include \"tree.h\"\n-#include \"strbuf.h\"\n-#include \"decorate.h\"\n-#include \"gpg-interface.h\"\n+#include \"trace.h\"\n #include \"string-list.h\"\n \n+struct reflog_walk_info;\n+struct rev_info;\n+struct ref;\n+struct signature_check;\n+struct sha1_array;\n+\n struct commit_list {\n \tstruct commit *item;\n \tstruct commit_list *next;\n@@ -151,7 +155,6 @@ struct userformat_want {\n };\n \n extern int has_non_ascii(const char *text);\n-struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */\n extern const char *logmsg_reencode(const struct commit *commit,\n \t\t\t\t   char **commit_encoding,\n \t\t\t\t   const char *output_encoding);\n@@ -231,8 +234,6 @@ extern struct commit_list *get_octopus_merge_bases(struct commit_list *in);\n /* largest positive number a signed 32-bit integer can contain */\n #define INFINITE_DEPTH 0x7fffffff\n \n-struct sha1_array;\n-struct ref;\n extern int register_shallow(const unsigned char *sha1);\n extern int unregister_shallow(const unsigned char *sha1);\n extern int for_each_commit_graft(each_commit_graft_fn, void *);\ndiff --git i/convert.h w/convert.h\nindex 0c2143c..e623527 100644\n--- i/convert.h\n+++ w/convert.h\n@@ -4,6 +4,8 @@\n #ifndef CONVERT_H\n #define CONVERT_H\n \n+struct strbuf;\n+\n enum safe_crlf {\n \tSAFE_CRLF_FALSE = 0,\n \tSAFE_CRLF_FAIL = 1,\ndiff --git i/csum-file.h w/csum-file.h\nindex bb543d5..9e29e35 100644\n--- i/csum-file.h\n+++ w/csum-file.h\n@@ -1,6 +1,8 @@\n #ifndef CSUM_FILE_H\n #define CSUM_FILE_H\n \n+#include \"cache.h\"\n+\n struct progress;\n \n /* A SHA1-protected file */\ndiff --git i/diffcore.h w/diffcore.h\nindex c876dac..96fc827 100644\n--- i/diffcore.h\n+++ w/diffcore.h\n@@ -4,6 +4,9 @@\n #ifndef DIFFCORE_H\n #define DIFFCORE_H\n \n+struct userdiff_driver;\n+struct diff_options;\n+\n /* This header file is internal between diff.c and its diff transformers\n  * (e.g. diffcore-rename, diffcore-pickaxe).  Never include this header\n  * in anything else.\n@@ -22,8 +25,6 @@\n \n #define MINIMUM_BREAK_SIZE     400 /* do not break a file smaller than this */\n \n-struct userdiff_driver;\n-\n struct diff_filespec {\n \tunsigned char sha1[20];\n \tchar *path;\ndiff --git i/object.h w/object.h\nindex 5e8d8ee..e61b290 100644\n--- i/object.h\n+++ w/object.h\n@@ -1,6 +1,8 @@\n #ifndef OBJECT_H\n #define OBJECT_H\n \n+#include \"cache.h\"\n+\n struct object_list {\n \tstruct object *item;\n \tstruct object_list *next;\ndiff --git i/tree-walk.h w/tree-walk.h\nindex ae7fb3a..d7612cf 100644\n--- i/tree-walk.h\n+++ w/tree-walk.h\n@@ -1,6 +1,8 @@\n #ifndef TREE_WALK_H\n #define TREE_WALK_H\n \n+struct strbuf;\n+\n struct name_entry {\n \tconst unsigned char *sha1;\n \tconst char *path;\ndiff --git i/tree.h w/tree.h\nindex d84ac63..ef84153 100644\n--- i/tree.h\n+++ w/tree.h\n@@ -3,6 +3,9 @@\n \n #include \"object.h\"\n \n+struct pathspec;\n+\n+\n extern const char *tree_type;\n \n struct tree {\n"},{"id":"249017","messageId":"20140907203049.GA61326@gmail.com","threadId":"37505","inReplyTo":"20140907194917.GB1611@google.com","subject":"Re: [RFC PATCH v2 2/2] headers: include dependent headers","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-09-07T20:30:51Z","receivedAt":"2014-09-07T20:30:51Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Sun, Sep 07, 2014 at 12:49:18PM -0700, Jonathan Nieder wrote:\n> David Aguilar wrote:\n> \n> > Add dependent headers so that including a header does not\n> > require including additional headers.\n> \n> I agree with this goal, modulo the compat-util.h caveat.  Thanks\n> for working on it.\n> \n> [...]\n> > --- a/archive.h\n> > +++ b/archive.h\n> > @@ -1,6 +1,7 @@\n> >  #ifndef ARCHIVE_H\n> >  #define ARCHIVE_H\n> >  \n> > +#include \"cache.h\"\n> >  #include \"pathspec.h\"\n> >  \n> >  struct archiver_args {\n> \n> I'm less happy about the way of achieving that goal.  Here's an\n> alternative.  Advantages:\n> \n>  * (fully expanded) headers stay small\n> \n>  * fewer other headers included as a side-effect of including one\n>    header, so callers are more likely to remember to #include the\n>    headers defining things they need (which makes later refactoring\n>    easier)\n> \n>  * circular header dependencies are harder to produce\n> \n> If this seems like a good direction to go in, I can finish the patch\n> later today\n\nYes, please, that would be sweet.\n\nWould you mind squashing in your sug to patch 1/2 as well when resending?\nIt seems like a nice improvement all around.\n\nRE: pre-compiled headers -- that might be a nice follow-up to\nthis series. I'm not very familiar with Windows so I don't know\nif it would be doable on mingw, cygwin, and msvc et al. but if\nit helps other platforms then it could be a nice feature.\n\nThanks Jonathan,\n-- \nDavid\n"},{"id":"249056","messageId":"xmqqiokylz46.fsf@gitster.dls.corp.google.com","threadId":"37505","inReplyTo":"1410049821-49861-1-git-send-email-davvid@gmail.com","subject":"Re: [RFC PATCH v2 1/2] Makefile: add check-headers target","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-09-08T18:56:57Z","receivedAt":"2014-09-08T18:56:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> +IFS='\n> +'\n> +git ls-files *.h ewah/*.h vcs-svn/*.h xdiff/*.h |\n\nHmm.  This is only for true developers (not one who merely compiles\nafter expanding a tarball), so \"git ls-files\" may probably be OK.\n\nBut \"/bin/ls\" would be equally fine for that, no?  After all, you\nare letting your shell to expand the wildcard, and a developer would\nwant to make sure his new header is kosher before running \"git add\"\non it.\n"},{"id":"249057","messageId":"vpqsik13o84.fsf@anie.imag.fr","threadId":"37505","inReplyTo":"xmqqiokylz46.fsf@gitster.dls.corp.google.com","subject":"Re: [RFC PATCH v2 1/2] Makefile: add check-headers target","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2014-09-08T19:29:31Z","receivedAt":"2014-09-08T19:29:31Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> David Aguilar <davvid@gmail.com> writes:\n>\n>> +IFS='\n>> +'\n>> +git ls-files *.h ewah/*.h vcs-svn/*.h xdiff/*.h |\n>\n> Hmm.  This is only for true developers (not one who merely compiles\n> after expanding a tarball), so \"git ls-files\" may probably be OK.\n>\n> But \"/bin/ls\" would be equally fine for that, no?\n\nActually, since this is \"| while read header\", I have to wonder why this\nis not written as\n\nfor header in .h ewah/*.h vcs-svn/*.h xdiff/*.h\ndo\n\t...\ndone\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"249061","messageId":"xmqqa969nav9.fsf@gitster.dls.corp.google.com","threadId":"37505","inReplyTo":"vpqsik13o84.fsf@anie.imag.fr","subject":"Re: [RFC PATCH v2 1/2] Makefile: add check-headers target","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-09-08T19:57:46Z","receivedAt":"2014-09-08T19:57:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> David Aguilar <davvid@gmail.com> writes:\n>>\n>>> +IFS='\n>>> +'\n>>> +git ls-files *.h ewah/*.h vcs-svn/*.h xdiff/*.h |\n>>\n>> Hmm.  This is only for true developers (not one who merely compiles\n>> after expanding a tarball), so \"git ls-files\" may probably be OK.\n>>\n>> But \"/bin/ls\" would be equally fine for that, no?\n>\n> Actually, since this is \"| while read header\", I have to wonder why this\n> is not written as\n>\n> for header in .h ewah/*.h vcs-svn/*.h xdiff/*.h\n> do\n> \t...\n> done\n\nYes, that would be even better.  Then you wouldn't even have to\nworry about $IFS dance.\n"},{"id":"249109","messageId":"20140910000328.GB12644@gmail.com","threadId":"37505","inReplyTo":"xmqqa969nav9.fsf@gitster.dls.corp.google.com","subject":"Re: [RFC PATCH v2 1/2] Makefile: add check-headers target","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-09-10T00:03:29Z","receivedAt":"2014-09-10T00:03:29Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Mon, Sep 08, 2014 at 12:57:46PM -0700, Junio C Hamano wrote:\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n> \n> > Junio C Hamano <gitster@pobox.com> writes:\n> >\n> >> David Aguilar <davvid@gmail.com> writes:\n> >>\n> >>> +IFS='\n> >>> +'\n> >>> +git ls-files *.h ewah/*.h vcs-svn/*.h xdiff/*.h |\n> >>\n> >> Hmm.  This is only for true developers (not one who merely compiles\n> >> after expanding a tarball), so \"git ls-files\" may probably be OK.\n> >>\n> >> But \"/bin/ls\" would be equally fine for that, no?\n> >\n> > Actually, since this is \"| while read header\", I have to wonder why this\n> > is not written as\n> >\n> > for header in .h ewah/*.h vcs-svn/*.h xdiff/*.h\n> > do\n> > \t...\n> > done\n> \n> Yes, that would be even better.  Then you wouldn't even have to\n> worry about $IFS dance.\n\nThe original motivation was to avoid picking up the generated\ncommon-cmds.h header file.\n\nIt was the N_() function that was messing it up.\n\nWould it make sense to split out a separate patch that makes common-cmds.h\ncheck-headers clean?\n-- \nDavid\n"},{"id":"249137","messageId":"xmqq38bzieqj.fsf@gitster.dls.corp.google.com","threadId":"37505","inReplyTo":"20140910000328.GB12644@gmail.com","subject":"Re: [RFC PATCH v2 1/2] Makefile: add check-headers target","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-09-10T17:09:56Z","receivedAt":"2014-09-10T17:09:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n> On Mon, Sep 08, 2014 at 12:57:46PM -0700, Junio C Hamano wrote:\n>> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>> ...\n>> > for header in .h ewah/*.h vcs-svn/*.h xdiff/*.h\n>> > do\n>> > \t...\n>> > done\n>> \n>> Yes, that would be even better.  Then you wouldn't even have to\n>> worry about $IFS dance.\n>\n> The original motivation was to avoid picking up the generated\n> common-cmds.h header file.\n\n\tfor header\n        do\n        \tcase \"$header\" in $exceptions) continue ;; esac\n\t\t...\n\tdone\n\nwith comments describing why these exceptions are made would be a\nbetter way to go in such a case.\n\n> It was the N_() function that was messing it up.\n>\n> Would it make sense to split out a separate patch that makes common-cmds.h\n> check-headers clean?\n\nDepends on why \"gcc -c $header\"-cleanliness needs to be strictly\nenforced, I think.  \n\n\"common-cmds.h\" is merely a way to allow us maintain a part of its\nsingle includer help.c mechanically maintained, and if anybody else\nincludes it, it is an error, even if that includer does so after\nincluding \"gettext.h\".\n\nSome effort would be required to butcher \"common-cmds.h' to make it\ninclude \"gettext.h\" but that amount of effort can be better spent to\nadd a check to make sure nobody else includes it, I would have to\nsay.\n"},{"id":"249140","messageId":"vpqk35bo0bh.fsf@anie.imag.fr","threadId":"37505","inReplyTo":"xmqq38bzieqj.fsf@gitster.dls.corp.google.com","subject":"Re: [RFC PATCH v2 1/2] Makefile: add check-headers target","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2014-09-10T17:24:50Z","receivedAt":"2014-09-10T17:24:50Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> David Aguilar <davvid@gmail.com> writes:\n>\n>> On Mon, Sep 08, 2014 at 12:57:46PM -0700, Junio C Hamano wrote:\n>>> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>>> ...\n>>> > for header in .h ewah/*.h vcs-svn/*.h xdiff/*.h\n>>> > do\n>>> > \t...\n>>> > done\n>>> \n>>> Yes, that would be even better.  Then you wouldn't even have to\n>>> worry about $IFS dance.\n>>\n>> The original motivation was to avoid picking up the generated\n>> common-cmds.h header file.\n>\n> \tfor header\n>         do\n>         \tcase \"$header\" in $exceptions) continue ;; esac\n> \t\t...\n> \tdone\n>\n> with comments describing why these exceptions are made would be a\n> better way to go in such a case.\n\n+1 from me. It would allow developers to use the rule without \"git\nadd\"-ing new .h files, and the comment would document why the\nexceptions are there (which missed in the original patch IMHO).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}