Skip to content

Commit fc42c28

Browse files
committed
util: don't include unnecessary system libraries
Remove some unnecessary includes from utility code.
1 parent ea62f54 commit fc42c28

File tree

14 files changed

+5
-20
lines changed

14 files changed

+5
-20
lines changed

src/date.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#endif
1212

1313
#include "util.h"
14-
#include "cache.h"
1514
#include "posix.h"
1615
#include "date.h"
1716

src/fs_path.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include "vector.h"
1515
#include "utf8.h"
1616

17-
#include "git2/sys/path.h"
18-
1917
/**
2018
* Path manipulation utils
2119
*

src/futils.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "win32/findfile.h"
1616
#endif
1717

18+
#define GIT_FILEMODE_DEFAULT 0100666
19+
1820
int git_futils_mkpath2file(const char *file_path, const mode_t mode)
1921
{
2022
return git_futils_mkdir(
@@ -256,7 +258,7 @@ int git_futils_readbuffer(git_str *buf, const char *path)
256258
}
257259

258260
int git_futils_writebuffer(
259-
const git_str *buf, const char *path, int flags, mode_t mode)
261+
const git_str *buf, const char *path, int flags, mode_t mode)
260262
{
261263
int fd, do_fsync = 0, error = 0;
262264

@@ -269,7 +271,7 @@ int git_futils_writebuffer(
269271
flags &= ~O_FSYNC;
270272

271273
if (!mode)
272-
mode = GIT_FILEMODE_BLOB;
274+
mode = GIT_FILEMODE_DEFAULT;
273275

274276
if ((fd = p_open(path, flags, mode)) < 0) {
275277
git_error_set(GIT_ERROR_OS, "could not open '%s' for writing", path);

src/hash.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include "common.h"
1212

13-
#include "git2/oid.h"
1413
#include "hash/sha1.h"
1514

1615
typedef struct {

src/net.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "netops.h"
1010

1111
#include <ctype.h>
12-
#include "git2/errors.h"
1312

1413
#include "posix.h"
1514
#include "str.h"

src/unix/map.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#include "common.h"
99

10-
#include "git2/common.h"
11-
1210
#if !defined(GIT_WIN32) && !defined(NO_MMAP)
1311

1412
#include "map.h"

src/unix/posix.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
#ifndef INCLUDE_unix_posix_h__
88
#define INCLUDE_unix_posix_h__
99

10-
#ifndef LIBGIT2_NO_FEATURES_H
11-
# include "git2/sys/features.h"
12-
#endif
10+
#include "common.h"
1311

1412
#include <stdio.h>
1513
#include <dirent.h>

src/unix/realpath.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
#include "common.h"
99

10-
#include "git2/common.h"
11-
1210
#ifndef GIT_WIN32
1311

1412
#include <limits.h>

tests/core/copy.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "clar_libgit2.h"
22
#include "futils.h"
3-
#include "path.h"
43
#include "posix.h"
54

65
void test_core_copy__file(void)

tests/core/env.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "clar_libgit2.h"
22
#include "futils.h"
33
#include "sysdir.h"
4-
#include "path.h"
54

65
#ifdef GIT_WIN32
76
#define NUM_VARS 5

0 commit comments

Comments
 (0)