util: don't include unnecessary system libraries Remove some unnecessary includes from utility code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
diff --git a/src/date.c b/src/date.c
index 52cc308..1529276 100644
--- a/src/date.c
+++ b/src/date.c
@@ -11,7 +11,6 @@
#endif
#include "util.h"
-#include "cache.h"
#include "posix.h"
#include "date.h"
diff --git a/src/fs_path.h b/src/fs_path.h
index 188dcf3..9720d34 100644
--- a/src/fs_path.h
+++ b/src/fs_path.h
@@ -14,8 +14,6 @@
#include "vector.h"
#include "utf8.h"
-#include "git2/sys/path.h"
-
/**
* Path manipulation utils
*
diff --git a/src/futils.c b/src/futils.c
index 7ec1009..454ed79 100644
--- a/src/futils.c
+++ b/src/futils.c
@@ -15,6 +15,8 @@
#include "win32/findfile.h"
#endif
+#define GIT_FILEMODE_DEFAULT 0100666
+
int git_futils_mkpath2file(const char *file_path, const mode_t mode)
{
return git_futils_mkdir(
@@ -256,7 +258,7 @@ int git_futils_readbuffer(git_str *buf, const char *path)
}
int git_futils_writebuffer(
- const git_str *buf, const char *path, int flags, mode_t mode)
+ const git_str *buf, const char *path, int flags, mode_t mode)
{
int fd, do_fsync = 0, error = 0;
@@ -269,7 +271,7 @@ int git_futils_writebuffer(
flags &= ~O_FSYNC;
if (!mode)
- mode = GIT_FILEMODE_BLOB;
+ mode = GIT_FILEMODE_DEFAULT;
if ((fd = p_open(path, flags, mode)) < 0) {
git_error_set(GIT_ERROR_OS, "could not open '%s' for writing", path);
diff --git a/src/hash.h b/src/hash.h
index 10b14a9..2b2eaf6 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -10,7 +10,6 @@
#include "common.h"
-#include "git2/oid.h"
#include "hash/sha1.h"
typedef struct {
diff --git a/src/net.c b/src/net.c
index 58792ee..a91e746 100644
--- a/src/net.c
+++ b/src/net.c
@@ -9,7 +9,6 @@
#include "netops.h"
#include <ctype.h>
-#include "git2/errors.h"
#include "posix.h"
#include "str.h"
diff --git a/src/unix/map.c b/src/unix/map.c
index 88f283c..23fcb78 100644
--- a/src/unix/map.c
+++ b/src/unix/map.c
@@ -7,8 +7,6 @@
#include "common.h"
-#include "git2/common.h"
-
#if !defined(GIT_WIN32) && !defined(NO_MMAP)
#include "map.h"
diff --git a/src/unix/posix.h b/src/unix/posix.h
index 7b3325e..27a8fec 100644
--- a/src/unix/posix.h
+++ b/src/unix/posix.h
@@ -7,9 +7,7 @@
#ifndef INCLUDE_unix_posix_h__
#define INCLUDE_unix_posix_h__
-#ifndef LIBGIT2_NO_FEATURES_H
-# include "git2/sys/features.h"
-#endif
+#include "common.h"
#include <stdio.h>
#include <dirent.h>
diff --git a/src/unix/realpath.c b/src/unix/realpath.c
index 893bac8..f1ca669 100644
--- a/src/unix/realpath.c
+++ b/src/unix/realpath.c
@@ -7,8 +7,6 @@
#include "common.h"
-#include "git2/common.h"
-
#ifndef GIT_WIN32
#include <limits.h>
diff --git a/tests/core/copy.c b/tests/core/copy.c
index b03d710..6d22b50 100644
--- a/tests/core/copy.c
+++ b/tests/core/copy.c
@@ -1,6 +1,5 @@
#include "clar_libgit2.h"
#include "futils.h"
-#include "path.h"
#include "posix.h"
void test_core_copy__file(void)
diff --git a/tests/core/env.c b/tests/core/env.c
index 88c5c6a..8ba9b91 100644
--- a/tests/core/env.c
+++ b/tests/core/env.c
@@ -1,7 +1,6 @@
#include "clar_libgit2.h"
#include "futils.h"
#include "sysdir.h"
-#include "path.h"
#ifdef GIT_WIN32
#define NUM_VARS 5
diff --git a/tests/core/link.c b/tests/core/link.c
index 6ab79b2..a1e2706 100644
--- a/tests/core/link.c
+++ b/tests/core/link.c
@@ -1,6 +1,5 @@
#include "clar_libgit2.h"
#include "posix.h"
-#include "path.h"
#ifdef GIT_WIN32
# include "win32/reparse.h"
diff --git a/tests/core/mkdir.c b/tests/core/mkdir.c
index 8d4b9af..58a4cfc 100644
--- a/tests/core/mkdir.c
+++ b/tests/core/mkdir.c
@@ -1,6 +1,5 @@
#include "clar_libgit2.h"
#include "futils.h"
-#include "path.h"
#include "posix.h"
static void cleanup_basic_dirs(void *ref)
diff --git a/tests/core/stat.c b/tests/core/stat.c
index 022380b..210072f 100644
--- a/tests/core/stat.c
+++ b/tests/core/stat.c
@@ -1,6 +1,5 @@
#include "clar_libgit2.h"
#include "futils.h"
-#include "path.h"
#include "posix.h"
void test_core_stat__initialize(void)
diff --git a/tests/path/win32.c b/tests/path/win32.c
index ff16639..64d8d8e 100644
--- a/tests/path/win32.c
+++ b/tests/path/win32.c
@@ -1,6 +1,5 @@
#include "clar_libgit2.h"
-#include "path.h"
#ifdef GIT_WIN32
#include "win32/path_w32.h"