]> git.ipfire.org Git - thirdparty/git.git/commitdiff
simplify inclusion of system header files.
authorJunio C Hamano <junkio@cox.net>
Tue, 19 Dec 2006 22:34:12 +0000 (14:34 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 20 Dec 2006 17:51:35 +0000 (09:51 -0800)
This is a mechanical clean-up of the way *.c files include
system header files.

 (1) sources under compat/, platform sha-1 implementations, and
     xdelta code are exempt from the following rules;

 (2) the first #include must be "git-compat-util.h" or one of
     our own header file that includes it first (e.g. config.h,
     builtin.h, pkt-line.h);

 (3) system headers that are included in "git-compat-util.h"
     need not be included in individual C source files.

 (4) "git-compat-util.h" does not have to include subsystem
     specific header files (e.g. expat.h).

Signed-off-by: Junio C Hamano <junkio@cox.net>
72 files changed:
archive-tar.c
archive-zip.c
blob.c
builtin-add.c
builtin-apply.c
builtin-archive.c
builtin-blame.c
builtin-branch.c
builtin-for-each-ref.c
builtin-grep.c
builtin-log.c
builtin-ls-files.c
builtin-mailinfo.c
builtin-mailsplit.c
builtin-mv.c
builtin-name-rev.c
builtin-pack-objects.c
builtin-repo-config.c
builtin-runstatus.c
builtin-shortlog.c
builtin-show-branch.c
builtin-stripspace.c
builtin-tar-tree.c
builtin-unpack-objects.c
builtin-upload-archive.c
color.c
compat/mmap.c
compat/setenv.c
compat/strlcpy.c
compat/unsetenv.c
config.c
connect.c
convert-objects.c
daemon.c
date.c
diff-delta.c
diff.c
diffcore-order.c
diffcore-pickaxe.c
dir.c
entry.c
fetch-pack.c
fetch.c
fsck-objects.c
git-compat-util.h
git.c
grep.c
help.c
ident.c
imap-send.c
index-pack.c
interpolate.c
lockfile.c
merge-base.c
merge-index.c
merge-recursive.c
path-list.c
path.c
receive-pack.c
refs.c
revision.c
rsh.c
run-command.c
ssh-upload.c
strbuf.c
test-date.c
test-delta.c
tree.c
unpack-trees.c
upload-pack.c
var.c
wt-status.c

index ff0f6e29292cf716ac32e8ae63a58902fcccc120..af47fdc95572bfa67b9c67369222a69c32ddea02 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "commit.h"
 #include "strbuf.h"
index 36e922a1f2ffe34264ac55c002072cb2777e7026..f31b8ed8236c3fcad10ac9a84e2f508f11e1a6cf 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "commit.h"
 #include "blob.h"
diff --git a/blob.c b/blob.c
index d1af2e62f14965fab491a3d9dde712f02b718adc..9776beac5827a4c705eddde426817dcc40c525bc 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -1,6 +1,5 @@
 #include "cache.h"
 #include "blob.h"
-#include <stdlib.h>
 
 const char *blob_type = "blob";
 
index b3f920676a958e581c55dcca48e9a8f01b43859b..c8a114fefb60a106dccffda5c703f2f00fa30ce9 100644 (file)
@@ -3,8 +3,6 @@
  *
  * Copyright (C) 2006 Linus Torvalds
  */
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "builtin.h"
 #include "dir.h"
index 436d9e188070df0e4a51186716b033658a8672b5..1c3583706835339d2f3a0b0a5d3b989aae2a8142 100644 (file)
@@ -6,7 +6,6 @@
  * This applies patches on top of some (arbitrary) version of the SCM.
  *
  */
-#include <fnmatch.h>
 #include "cache.h"
 #include "cache-tree.h"
 #include "quote.h"
index a8a1f079bf4e28a3f07d49b6a4723ee8dea17178..391cf43911a16ec49862c18b7dd4f1f094d49de8 100644 (file)
@@ -2,7 +2,6 @@
  * Copyright (c) 2006 Franck Bui-Huu
  * Copyright (c) 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "builtin.h"
 #include "archive.h"
index a250724463fff1990c4f513cfa8468e36acc8c41..9bf6ec951fb5d7535441a8db5b73d20f509ed982 100644 (file)
 #include "revision.h"
 #include "xdiff-interface.h"
 
-#include <time.h>
-#include <sys/time.h>
-#include <regex.h>
-
 static char blame_usage[] =
 "git-blame [-c] [-l] [-t] [-f] [-n] [-p] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [commit] [--] file\n"
 "  -c, --compatibility Use the same output mode as git-annotate (Default: off)\n"
index 560309cb154504a8d280f12e3d9d2d3d6d715d7c..515330c155a8e54c72fd02ea74e30be10b852490 100644 (file)
@@ -5,8 +5,8 @@
  * Based on git-branch.sh by Junio C Hamano.
  */
 
-#include "color.h"
 #include "cache.h"
+#include "color.h"
 #include "refs.h"
 #include "commit.h"
 #include "builtin.h"
index 227aa3cd7f887ad44fd6b885479ef2afb586ded4..af72a12a5798265cece6c7b72582fd3672421394 100644 (file)
@@ -6,7 +6,6 @@
 #include "tree.h"
 #include "blob.h"
 #include "quote.h"
-#include <fnmatch.h>
 
 /* Quoting styles */
 #define QUOTE_NONE 0
index 9873e3d1dbf0e8735641cc178d687a9d5194487e..3b1b1cbbfa7bf348c17c025afa217ffff97087e3 100644 (file)
 #include "tag.h"
 #include "tree-walk.h"
 #include "builtin.h"
-#include <regex.h>
 #include "grep.h"
-#include <fnmatch.h>
-#include <sys/wait.h>
 
 /*
  * git grep pathspecs are somewhat different from diff-tree pathspecs;
index 17014f70a2896de46ff4714e77093b8adaa9fc8f..8df3c1394a0b70548708137bfe20126fbea01709 100644 (file)
@@ -11,8 +11,6 @@
 #include "log-tree.h"
 #include "builtin.h"
 #include "tag.h"
-#include <time.h>
-#include <sys/time.h>
 
 static int default_show_root = 1;
 
index bc79ce40fc87b7a77d22f2fea85f2198102fcb67..21c2a6e2d9b68c0c3bcfac824e85c7b392c72486 100644 (file)
@@ -5,8 +5,6 @@
  *
  * Copyright (C) Linus Torvalds, 2005
  */
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "quote.h"
 #include "dir.h"
index b8d7dbc0b71929a95aaebd79d5912897d5eb70e7..e6472293d47611d415276f6057227d9c93788f63 100644 (file)
@@ -2,15 +2,6 @@
  * Another stupid program, this one parsing the headers of an
  * email to figure out authorship and subject
  */
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#ifndef NO_ICONV
-#include <iconv.h>
-#endif
-#include "git-compat-util.h"
 #include "cache.h"
 #include "builtin.h"
 
index 91a699d34d93462b56f2591193bb5729b42b3950..3bca855aae857cde15f2a249f8e0a5c30b3e7d82 100644 (file)
@@ -4,13 +4,6 @@
  * It just splits a mbox into a list of files: "0001" "0002" ..
  * so you can process them further from there.
  */
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdio.h>
 #include "cache.h"
 #include "builtin.h"
 
index d14a4a7f5c66c5f8712399d4b1fc566e0891125a..737af350b873e90c787cb49960236fc19b62a3bf 100644 (file)
@@ -3,8 +3,6 @@
  *
  * Copyright (C) 2006 Johannes Schindelin
  */
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "builtin.h"
 #include "dir.h"
index 618aa314d22dd16bb62b0a7deb3be14fda411ebe..b4f15cc38ab7fa045fc5cf025ca3fd6251a01973 100644 (file)
@@ -1,4 +1,3 @@
-#include <stdlib.h>
 #include "builtin.h"
 #include "cache.h"
 #include "commit.h"
index a2dc7d1d9d39436e8e5266d1d4bb693b06a54b17..807be8c3f8a051d9171cf2ee3c9f973f77a2ff08 100644 (file)
@@ -12,8 +12,6 @@
 #include "diff.h"
 #include "revision.h"
 #include "list-objects.h"
-#include <sys/time.h>
-#include <signal.h>
 
 static const char pack_usage[] = "\
 git-pack-objects [{ -q | --progress | --all-progress }] \n\
index a38099a63d20d6f4a8187770c84e3a180ebeaa52..a7ab4cee58fcd316497d10a766602e9fbd577998 100644 (file)
@@ -1,6 +1,5 @@
 #include "builtin.h"
 #include "cache.h"
-#include <regex.h>
 
 static const char git_config_set_usage[] =
 "git-repo-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --list";
index 0b63037dd04e7c66d2e378ee394979cec040fe55..4b489b1214e1ae693a9b0b5166909800f5ca94ac 100644 (file)
@@ -1,5 +1,5 @@
-#include "wt-status.h"
 #include "cache.h"
+#include "wt-status.h"
 
 extern int wt_status_use_color;
 
index 3fc43dd7dd89fea2fb7f02e694ed632215002e13..edb40429ec4465f3bebba02f2174314dd0183225 100644 (file)
@@ -4,7 +4,6 @@
 #include "diff.h"
 #include "path-list.h"
 #include "revision.h"
-#include <string.h>
 
 static const char shortlog_usage[] =
 "git-shortlog [-n] [-s] [<commit-id>... ]";
index a38ac34efb8738fca2b415a47f782dd3745e9ff9..b9d9781d4d6a12860d377607369a4dea95a3c7be 100644 (file)
@@ -1,5 +1,3 @@
-#include <stdlib.h>
-#include <fnmatch.h>
 #include "cache.h"
 #include "commit.h"
 #include "refs.h"
index 09cc9108cdaf2aa20dc10788bccd2fee0ae9b02a..f0d4d9e2d10446a229094c991363f5a17ce4c666 100644 (file)
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
 #include "builtin.h"
 
 /*
index 4d4cfec878e468b8ab8a7f055c836c3569443914..11e62fc141f592977373630c7671d3e7e914c314 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, 2006 Rene Scharfe
  */
-#include <time.h>
 #include "cache.h"
 #include "commit.h"
 #include "tar.h"
index e6d75748444ef4fc263970d4fe87b4623d2790fc..d351e02649401364e7384d0e784901e6f3fcb119 100644 (file)
@@ -8,8 +8,6 @@
 #include "tag.h"
 #include "tree.h"
 
-#include <sys/time.h>
-
 static int dry_run, quiet, recover, has_errors;
 static const char unpack_usage[] = "git-unpack-objects [-n] [-q] [-r] < pack-file";
 
index 45c92e163c477af4ec7c36c8ee6fcfd9242a0b2d..e4156f8f48aeed307b1754bada173034dd81a311 100644 (file)
@@ -1,9 +1,6 @@
 /*
  * Copyright (c) 2006 Franck Bui-Huu
  */
-#include <time.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
 #include "cache.h"
 #include "builtin.h"
 #include "archive.h"
diff --git a/color.c b/color.c
index d8c8399d5916432eaa4122175f5e5d7ce209001b..09d82eec3d0adf5b7bd8828b0c8df0554695f75c 100644 (file)
--- a/color.c
+++ b/color.c
@@ -1,8 +1,5 @@
-#include "color.h"
 #include "cache.h"
-#include "git-compat-util.h"
-
-#include <stdarg.h>
+#include "color.h"
 
 #define COLOR_RESET "\033[m"
 
index a4d2e507f73c5595a2ca76c0369349cc11e2426f..0fd46e793d088e6567b20c7e81a5cde7023bdb58 100644 (file)
@@ -1,7 +1,3 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
 #include "../git-compat-util.h"
 
 void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset)
index b7d76785980b81a6f1057d678d34a732f45ca4cd..3a22ea7b751efb768d72afa2f97fd963e10eec7e 100644 (file)
@@ -1,5 +1,4 @@
-#include <stdlib.h>
-#include <string.h>
+#include "../git-compat-util.h"
 
 int gitsetenv(const char *name, const char *value, int replace)
 {
index b66856a3a50a93262ee4b5bd0294bb0c7fc85b15..4024c360301ebe7d58ac5b84dcbb692341b649ed 100644 (file)
@@ -1,4 +1,4 @@
-#include <string.h>
+#include "../git-compat-util.h"
 
 size_t gitstrlcpy(char *dest, const char *src, size_t size)
 {
index 3a5e4ec04ae4a523823e633031b85559bf5dc973..eb29f5e0849370afe90c400271fea12e0f9090aa 100644 (file)
@@ -1,5 +1,4 @@
-#include <stdlib.h>
-#include <string.h>
+#include "../git-compat-util.h"
 
 void gitunsetenv (const char *name)
 {
index 8cbdd178bd9e678774b65cc9ab2da6b169bdc1ca..e86b2328abe11a7e1c299e65086a0dbcca721a6c 100644 (file)
--- a/config.c
+++ b/config.c
@@ -6,7 +6,6 @@
  *
  */
 #include "cache.h"
-#include <regex.h>
 
 #define MAXNAME (256)
 
index f7edba82c4d2fcc642ccae785aa7a315b1f819d6..66daa11a5737efd6ee2dbd6ff2ad0e1475fcba20 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -3,12 +3,6 @@
 #include "pkt-line.h"
 #include "quote.h"
 #include "refs.h"
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <signal.h>
 
 static char *server_capabilities;
 
index 881258311a47f9faa437ec02e99b4a0df1439d53..a63013298566fd3dc21275a90ca976227de8c7f0 100644 (file)
@@ -1,7 +1,3 @@
-#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
-#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
-#define _GNU_SOURCE
-#include <time.h>
 #include "cache.h"
 #include "blob.h"
 #include "commit.h"
index e66bb802da9faed6e01229fffbe56e3d7cca60c6..b129b83e4026490c1e6e77861cd6f03a5007d01e 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -1,20 +1,10 @@
-#include <signal.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/poll.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <syslog.h>
-#include <pwd.h>
-#include <grp.h>
-#include <limits.h>
-#include "pkt-line.h"
 #include "cache.h"
+#include "pkt-line.h"
 #include "exec_cmd.h"
 #include "interpolate.h"
 
+#include <syslog.h>
+
 #ifndef HOST_NAME_MAX
 #define HOST_NAME_MAX 256
 #endif
diff --git a/date.c b/date.c
index 18259227321f47988386c2bd70888b3c967d8ab6..7acb8cbd91bb1491931326ade1905d9c6f7bfdf5 100644 (file)
--- a/date.c
+++ b/date.c
@@ -4,9 +4,6 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 
-#include <time.h>
-#include <sys/time.h>
-
 #include "cache.h"
 
 static time_t my_mktime(struct tm *tm)
index fa16d06c8d1e85a458428c673cb2f589857f5424..9f998d0a73e0127d3a68a7caecb3727569149871 100644 (file)
  *  licensing gets turned into GPLv2 within this project.
  */
 
-#include <stdlib.h>
-#include <string.h>
-#include "delta.h"
-
 #include "git-compat-util.h"
+#include "delta.h"
 
 /* maximum hash entry list for the same hash bucket */
 #define HASH_LIMIT 64
diff --git a/diff.c b/diff.c
index 6e6f2a765c28919d80e7172152d1f760985b605b..91f956b23b0d641e4e330e1e22c0b8bc8cc0fed0 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1,9 +1,6 @@
 /*
  * Copyright (C) 2005 Junio C Hamano
  */
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
 #include "cache.h"
 #include "quote.h"
 #include "diff.h"
index aef6da60447b98a05d91513b4aa74e505b0a0d84..7ad09461858aa6832b828df411fd1b736f035465 100644 (file)
@@ -4,7 +4,6 @@
 #include "cache.h"
 #include "diff.h"
 #include "diffcore.h"
-#include <fnmatch.h>
 
 static char **order;
 static int order_cnt;
index cfcce315babb0edb7ad7be7f2ab2437aaf41eb9d..de44adabf09dcb47090e7865d6cd77677115d2b6 100644 (file)
@@ -5,8 +5,6 @@
 #include "diff.h"
 #include "diffcore.h"
 
-#include <regex.h>
-
 static unsigned int contains(struct diff_filespec *one,
                             const char *needle, unsigned long len,
                             regex_t *regexp)
diff --git a/dir.c b/dir.c
index e6a61ee913d9f0f4f56402bdb451689cb80373ab..16401d8017c5d96dc17ac9d52ab77eabbc4e9270 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -5,9 +5,6 @@
  * Copyright (C) Linus Torvalds, 2005-2006
  *              Junio Hamano, 2005-2006
  */
-#include <dirent.h>
-#include <fnmatch.h>
-
 #include "cache.h"
 #include "dir.h"
 
diff --git a/entry.c b/entry.c
index b2ea0efa82e1a0511fe5aa798618c23827b59bab..88df7139477f94c236f93ca835c28ed4dd9543de 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -1,5 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
 #include "cache.h"
 #include "blob.h"
 
index 743eab7efaa5b53a56d432bea268dda04350be7b..92322cf4da39434d44e4aa52fa0c3f735b22d752 100644 (file)
@@ -5,7 +5,6 @@
 #include "tag.h"
 #include "exec_cmd.h"
 #include "sideband.h"
-#include <sys/wait.h>
 
 static int keep_pack;
 static int quiet;
diff --git a/fetch.c b/fetch.c
index 663b4b2f42744a2d12ba1d8661b8b0d3645ef82b..f69be82f10d287d71f6184c4b9203bdab3ce81fc 100644 (file)
--- a/fetch.c
+++ b/fetch.c
@@ -1,6 +1,5 @@
-#include "fetch.h"
-
 #include "cache.h"
+#include "fetch.h"
 #include "commit.h"
 #include "tree.h"
 #include "tree-walk.h"
index 46b628cb94375e3f645f868efb04547ffc20e6e7..409aea02b4f8570dbaf0a8425eb29e5d45515367 100644 (file)
@@ -1,6 +1,3 @@
-#include <sys/types.h>
-#include <dirent.h>
-
 #include "cache.h"
 #include "commit.h"
 #include "tree.h"
index 0272d043d0b82dc6ad0ff4836fe8db8ed1e1d960..bc296b3a45708296c3f14f5af53624801045e554 100644 (file)
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
+#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
+#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
+#define _GNU_SOURCE
+#define _BSD_SOURCE
+
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <limits.h>
 #include <sys/param.h>
-#include <netinet/in.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <sys/time.h>
+#include <time.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <fnmatch.h>
+#include <sys/poll.h>
+#include <sys/socket.h>
+#include <assert.h>
+#include <regex.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <grp.h>
+
+#ifndef NO_ICONV
+#include <iconv.h>
+#endif
 
 /* On most systems <limits.h> would have given us this, but
  * not on some systems (e.g. GNU/Hurd).
diff --git a/git.c b/git.c
index 016ee8adb730ea7c390dcb84dcbbafda7936f2d5..73cf4d4e019c2c0169e6181b2c557cdeb3f962e7 100644 (file)
--- a/git.c
+++ b/git.c
@@ -1,20 +1,8 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include "git-compat-util.h"
+#include "builtin.h"
 #include "exec_cmd.h"
 #include "cache.h"
 #include "quote.h"
 
-#include "builtin.h"
-
 const char git_usage_string[] =
        "git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--help] COMMAND [ARGS]";
 
diff --git a/grep.c b/grep.c
index 0fc078ec0ac42e39125c8e5a8f05a3b6ecae4fa3..fcc676230282e4c5bda4f9f97c5ae65c1a6beb30 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -1,5 +1,4 @@
 #include "cache.h"
-#include <regex.h>
 #include "grep.h"
 
 void append_grep_pattern(struct grep_opt *opt, const char *pat,
diff --git a/help.c b/help.c
index 0824c25226ad7b106e56d1b7c23fad40eed92749..341b9e370eec4fa90014249a63afac17b083b275 100644 (file)
--- a/help.c
+++ b/help.c
@@ -3,12 +3,11 @@
  *
  * Builtin help-related commands (help, usage, version)
  */
-#include <sys/ioctl.h>
 #include "cache.h"
 #include "builtin.h"
 #include "exec_cmd.h"
 #include "common-cmds.h"
-
+#include <sys/ioctl.h>
 
 /* most GUI terminals set COLUMNS (although some don't export it) */
 static int term_columns(void)
diff --git a/ident.c b/ident.c
index d7faba6a70139020d9ee0a2f801ae2e6b567d4f4..6ad8fedd60ba1461d77dc2b1d66e52cf56158c6f 100644 (file)
--- a/ident.c
+++ b/ident.c
@@ -7,9 +7,6 @@
  */
 #include "cache.h"
 
-#include <pwd.h>
-#include <netdb.h>
-
 static char git_default_date[50];
 
 static void copy_gecos(struct passwd *w, char *name, int sz)
index a6a65680ee6daf062180d2580e83616cfff4cda4..894cbbdf53ccf4728276b46b9491f409f3b9e03b 100644 (file)
 
 #include "cache.h"
 
-#include <assert.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netdb.h>
-
 typedef struct store_conf {
        char *name;
        const char *path; /* should this be here? its interpretation is driver-specific */
index c05feae16172ab4bae73cb5b2501dfde418ad5d8..43e007f8238006313e95b7d386a590ce51144dfa 100644 (file)
@@ -1,8 +1,3 @@
-#define _XOPEN_SOURCE 600
-#include <unistd.h>
-#include <sys/time.h>
-#include <signal.h>
-
 #include "cache.h"
 #include "delta.h"
 #include "pack.h"
index 5d9d1889f088c64131cd3c116e6a16876ce95db8..f992ef77533737fe2ec52dc3b662cb6cacca0ea2 100644 (file)
@@ -2,8 +2,6 @@
  * Copyright 2006 Jon Loeliger
  */
 
-#include <string.h>
-
 #include "git-compat-util.h"
 #include "interpolate.h"
 
index 2a2fea3cb6bd1de059e7c0f8c2008c5fe8376b93..261baff049cd8b2e4d1b1a269992851eb00b2aa8 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Copyright (c) 2005, Junio C Hamano
  */
-#include <signal.h>
 #include "cache.h"
 
 static struct lock_file *lock_file_list;
index 009caf804b43fdd644ff08991d55d0e417fd34d8..385f4ba386ada3e43f962d9051cf4b651320fcd3 100644 (file)
@@ -1,4 +1,3 @@
-#include <stdlib.h>
 #include "cache.h"
 #include "commit.h"
 
index 646d090c58e774bdf0f412da39f4b67fd7a696c6..a9983dd78ad5cd1e364f0e00c259bdb7e6f151f0 100644 (file)
@@ -1,7 +1,3 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-
 #include "cache.h"
 
 static const char *pgm;
index 6dd6e2e5af779f2b3ad5da050776c37646b45a84..1de273ea1e4f309b542c8ebfce706ba422e1cd74 100644 (file)
@@ -3,13 +3,6 @@
  * Fredrik Kuivinen.
  * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
  */
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
 #include "cache.h"
 #include "cache-tree.h"
 #include "commit.h"
index f8800f8e66e39f035820c2aeb0843fb3ebf65fb3..caaa5cc57b05e1a27bb4fd8f49bb74e06b9936e3 100644 (file)
@@ -1,4 +1,3 @@
-#include <stdio.h>
 #include "cache.h"
 #include "path-list.h"
 
diff --git a/path.c b/path.c
index d2c076d7cbad3a16a002897d926cc13633be4f77..066f62195508033a5f72504e4805ea436424296e 100644 (file)
--- a/path.c
+++ b/path.c
@@ -11,7 +11,6 @@
  * which is what it's designed for.
  */
 #include "cache.h"
-#include <pwd.h>
 
 static char bad_path[] = "/bad-path/";
 
index 5e5510bc3dadff835324f46b0cd936ceba8f1c6e..59b682c03af53fbfe600d063fa832f874440493c 100644 (file)
@@ -6,7 +6,6 @@
 #include "exec_cmd.h"
 #include "commit.h"
 #include "object.h"
-#include <sys/wait.h>
 
 static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
 
diff --git a/refs.c b/refs.c
index d911b9e86009aa3d81c6c4d310a26bf057920e8a..a101ff3bf88dafa56ac85fcd977c0ae6be1b495e 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1,10 +1,8 @@
-#include "refs.h"
 #include "cache.h"
+#include "refs.h"
 #include "object.h"
 #include "tag.h"
 
-#include <errno.h>
-
 /* ISSYMREF=01 and ISPACKED=02 are public interfaces */
 #define REF_KNOWS_PEELED 04
 
index 993bb668a205a9fb3e2f5ddd2f378f10ac7905b4..7b6f91f83ef4a04f1af74daf37fbae2da7eac0d7 100644 (file)
@@ -6,7 +6,6 @@
 #include "diff.h"
 #include "refs.h"
 #include "revision.h"
-#include <regex.h>
 #include "grep.h"
 
 static char *path_name(struct name_path *path, const char *name)
diff --git a/rsh.c b/rsh.c
index f34409e1bc5fcf3b6295021043339793b25a8913..5754a230e2c23ce3fea255fccd8726af76c13317 100644 (file)
--- a/rsh.c
+++ b/rsh.c
@@ -1,10 +1,6 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
+#include "cache.h"
 #include "rsh.h"
 #include "quote.h"
-#include "cache.h"
 
 #define COMMAND_SIZE 4096
 
index 61908682b9b251ac49ae655522a3143476a888ea..492ad3e64ce5d2435c029ab032f1221347f37c19 100644 (file)
@@ -1,6 +1,5 @@
 #include "cache.h"
 #include "run-command.h"
-#include <sys/wait.h>
 #include "exec_cmd.h"
 
 int run_command_v_opt(int argc, const char **argv, int flags)
index 20b15eab57e1c4f7c4b306010d7d12bff2308141..0b52ae15cbd216bff5002c89e0c8af84ea68ed1a 100644 (file)
@@ -12,8 +12,6 @@
 #include "rsh.h"
 #include "refs.h"
 
-#include <string.h>
-
 static unsigned char local_version = 1;
 static unsigned char remote_version;
 
index 9d9d8bed915483abbc2ebb340e0881ae4e296bd4..7f14b0fb59bd7e14979b002f441ae84ff5b0e9a2 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,7 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include "strbuf.h"
 #include "cache.h"
+#include "strbuf.h"
 
 void strbuf_init(struct strbuf *sb) {
        sb->buf = NULL;
index 93e802759f1906665857c82c71f589b7d636b540..62e8f2387a1cab97ec1c71d1993d082274e17bf5 100644 (file)
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <time.h>
-
 #include "cache.h"
 
 int main(int argc, char **argv)
index 1be8ee0c721ec35372fee4e686d9664b143b4345..795aa08377aaa9a229affaa054e243251436f755 100644 (file)
@@ -8,13 +8,7 @@
  * published by the Free Software Foundation.
  */
 
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
+#include "git-compat-util.h"
 #include "delta.h"
 
 static const char usage[] =
diff --git a/tree.c b/tree.c
index ea386e506659c65224cfe55bdc4f8d086171637a..b6f02fecc46ec4633dc1ee75f38bc90761a4fbe3 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -4,7 +4,6 @@
 #include "commit.h"
 #include "tag.h"
 #include "tree-walk.h"
-#include <stdlib.h>
 
 const char *tree_type = "tree";
 
index b8689ebc86bb69c21fd650572c55a4c3d246a183..2e2232cbb07e61de3be74302fba67142a58a857b 100644 (file)
@@ -1,5 +1,3 @@
-#include <signal.h>
-#include <sys/time.h>
 #include "cache.h"
 #include "dir.h"
 #include "tree.h"
index 4572fff07ca39a53a69453fdc8037e3aae1605a6..32b06b2e66099787d621c2557a8a9ee00aec4be6 100644 (file)
@@ -1,6 +1,3 @@
-#include <signal.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
 #include "cache.h"
 #include "refs.h"
 #include "pkt-line.h"
diff --git a/var.c b/var.c
index a57a33b81ac6c9cb5ec0c833edc21bd66428d976..39977b949a1be61f1cf35512bd729862de842108 100644 (file)
--- a/var.c
+++ b/var.c
@@ -4,9 +4,6 @@
  * Copyright (C) Eric Biederman, 2005
  */
 #include "cache.h"
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
 
 static const char var_usage[] = "git-var [-l | <variable>]";
 
index cface6ca88666d5e1de116110cb52eea4d91a5f1..db427384ff454aa07e38c588537cbaa6b835dee6 100644 (file)
@@ -1,6 +1,6 @@
+#include "cache.h"
 #include "wt-status.h"
 #include "color.h"
-#include "cache.h"
 #include "object.h"
 #include "dir.h"
 #include "commit.h"