@@ -1,5 +1,6 @@
#define COMPAT_CODE_ACCESS
-#include "../git-compat-util.h"
+
+#include "git-compat-util.h"
/* Do the same thing access(2) does, but use the effective uid,
* and don't make the mistake of telling root that any file is
@@ -1,5 +1,5 @@
-#include "../git-compat-util.h"
-#include "../strbuf.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
/* Adapted from libiberty's basename.c. */
char *gitbasename (char *path)
@@ -1,5 +1,5 @@
#define COMPAT_CODE_FILENO
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
int git_fileno(FILE *stream)
{
@@ -9,7 +9,7 @@
* fopen after including git-compat-util.h is inadequate in this case.
*/
#define SUPPRESS_FOPEN_REDEFINITION
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
FILE *git_fopen(const char *path, const char *mode)
{
@@ -1,7 +1,7 @@
#include "git-compat-util.h"
+#include "compat/fsmonitor/fsm-health.h"
#include "config.h"
#include "fsmonitor-ll.h"
-#include "fsm-health.h"
#include "fsmonitor--daemon.h"
int fsm_health__ctor(struct fsmonitor_daemon_state *state UNUSED)
@@ -1,7 +1,7 @@
#include "git-compat-util.h"
+#include "compat/fsmonitor/fsm-health.h"
#include "config.h"
#include "fsmonitor-ll.h"
-#include "fsm-health.h"
#include "fsmonitor--daemon.h"
#include "gettext.h"
#include "simple-ipc.h"
@@ -1,6 +1,6 @@
#ifndef __clang__
#include <dispatch/dispatch.h>
-#include "fsm-darwin-gcc.h"
+#include "compat/fsmonitor/fsm-darwin-gcc.h"
#else
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
@@ -24,8 +24,8 @@
#endif
#include "git-compat-util.h"
+#include "compat/fsmonitor/fsm-listen.h"
#include "fsmonitor-ll.h"
-#include "fsm-listen.h"
#include "fsmonitor--daemon.h"
#include "fsmonitor-path-utils.h"
#include "gettext.h"
@@ -1,7 +1,7 @@
#include "git-compat-util.h"
+#include "compat/fsmonitor/fsm-listen.h"
#include "config.h"
#include "fsmonitor-ll.h"
-#include "fsm-listen.h"
#include "fsmonitor--daemon.h"
#include "gettext.h"
#include "simple-ipc.h"
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
#ifndef NS_INADDRSZ
#define NS_INADDRSZ 4
@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
#ifndef NS_INT16SZ
#define NS_INT16SZ 2
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
void *gitmemmem(const void *haystack, size_t haystack_len,
const void *needle, size_t needle_len)
@@ -1,22 +1,22 @@
#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
-#include "../git-compat-util.h"
-#include "win32.h"
+#include "git-compat-util.h"
+#include "compat/win32.h"
#include <aclapi.h>
#include <sddl.h>
#include <conio.h>
#include <wchar.h>
-#include "../strbuf.h"
-#include "../run-command.h"
-#include "../abspath.h"
-#include "../alloc.h"
-#include "win32/lazyload.h"
-#include "../config.h"
-#include "../environment.h"
-#include "../trace2.h"
-#include "../symlinks.h"
-#include "../wrapper.h"
+#include "strbuf.h"
+#include "run-command.h"
+#include "abspath.h"
+#include "alloc.h"
+#include "compat/win32/lazyload.h"
+#include "config.h"
+#include "environment.h"
+#include "trace2.h"
+#include "symlinks.h"
+#include "wrapper.h"
#include "dir.h"
#include "gettext.h"
#define SECURITY_WIN32
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
#undef mkdir
/* for platforms that can't deal with a trailing '/' */
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
char *gitmkdtemp(char *template)
{
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
{
@@ -1,6 +1,6 @@
-#include "../git-compat-util.h"
-#include "win32.h"
+#include "git-compat-util.h"
+#include "compat/win32.h"
#include <conio.h>
-#include "../strbuf.h"
+#include "strbuf.h"
-#include "mingw.c"
+#include "compat/mingw.c"
@@ -1,5 +1,5 @@
#include "git-compat-util.h"
-#include "nonblock.h"
+#include "compat/nonblock.h"
#ifdef O_NONBLOCK
@@ -14,7 +14,7 @@ int enable_pipe_nonblock(int fd)
#elif defined(GIT_WINDOWS_NATIVE)
-#include "win32.h"
+#include "compat/win32.h"
int enable_pipe_nonblock(int fd)
{
@@ -19,7 +19,7 @@
#include "git-compat-util.h"
#include <gettext.h>
-#include "obstack.h"
+#include "compat/obstack.h"
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
incremented whenever callers compiled using an old obstack.h can no
@@ -1,5 +1,5 @@
-#include "../git-compat-util.h"
-#include "../wrapper.h"
+#include "git-compat-util.h"
+#include "wrapper.h"
ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
{
@@ -7,13 +7,13 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
+#include "compat/precompose_utf8.h"
#include "config.h"
#include "environment.h"
#include "gettext.h"
#include "path.h"
#include "strbuf.h"
#include "utf8.h"
-#include "precompose_utf8.h"
typedef char *iconv_ibp;
static const char *repo_encoding = "UTF-8";
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
/*
* A merge sort implementation, simplified from the qsort implementation
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
#undef regcomp
int git_regcomp(regex_t *preg, const char *pattern, int cflags)
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
int gitsetenv(const char *name, const char *value, int replace)
{
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
/*
* The size parameter specifies the available space, i.e. includes
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
char *gitstrcasestr(const char *haystack, const char *needle)
{
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
char *gitstrdup(const char *s1)
{
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
size_t gitstrlcpy(char *dest, const char *src, size_t size)
{
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
intmax_t gitstrtoimax (const char *nptr, char **endptr, int base)
{
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base)
{
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
int gitunsetenv(const char *name)
{
@@ -1,4 +1,4 @@
-#include "../../git-compat-util.h"
+#include "git-compat-util.h"
struct DIR {
struct dirent dd_dir; /* includes d_type */
@@ -1,6 +1,6 @@
#include "git-compat-util.h"
#include <winternl.h>
-#include "lazyload.h"
+#include "compat/win32/lazyload.h"
int win32_fsync_no_flush(int fd)
{
@@ -1,7 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
-#include "../../git-compat-util.h"
-#include "../../environment.h"
+#include "git-compat-util.h"
+#include "environment.h"
int win32_has_dos_drive_prefix(const char *path)
{
@@ -7,8 +7,8 @@
* no need for double-checking.
*/
-#include "../../git-compat-util.h"
-#include "pthread.h"
+#include "git-compat-util.h"
+#include "compat/win32/pthread.h"
#include <errno.h>
#include <limits.h>
@@ -1,4 +1,4 @@
-#include "../../git-compat-util.h"
+#include "git-compat-util.h"
static HANDLE ms_eventlog;
@@ -1,10 +1,10 @@
#define USE_THE_REPOSITORY_VARIABLE
-#include "../../git-compat-util.h"
-#include "../../json-writer.h"
-#include "../../repository.h"
-#include "../../trace2.h"
-#include "lazyload.h"
+#include "git-compat-util.h"
+#include "compat/win32/lazyload.h"
+#include "json-writer.h"
+#include "repository.h"
+#include "trace2.h"
#include <psapi.h>
#include <tlhelp32.h>
@@ -1,6 +1,6 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
{
@@ -6,11 +6,11 @@
#define DISABLE_SIGN_COMPARE_WARNINGS
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
#include <wingdi.h>
#include <winreg.h>
-#include "win32.h"
-#include "win32/lazyload.h"
+#include "compat/win32.h"
+#include "compat/win32/lazyload.h"
static int fd_is_interactive[3] = { 0, 0, 0 };
#define FD_CONSOLE 0x1
@@ -501,7 +501,7 @@ endif
compat/win32/pthread.o compat/win32/syslog.o \
compat/win32/trace2_win32_process_info.o \
compat/win32/dirent.o
- COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
+ COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DDETECT_MSYS_TTY -DNOGDI -DHAVE_STRING_H -Icompat/regex -Icompat/win32 -DSTRIP_EXTENSION=\".exe\"
BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -ENTRY:wmainCRTStartup -SUBSYSTEM:CONSOLE
# invalidcontinue.obj allows Git's source code to close the same file
# handle twice, or to access the osfhandle of an already-closed stdout
@@ -692,7 +692,7 @@ ifeq ($(uname_S),MINGW)
HAVE_PLATFORM_PROCINFO = YesPlease
CSPRNG_METHOD = rtlgenrandom
BASIC_LDFLAGS += -municode
- COMPAT_CFLAGS += -DNOGDI -Icompat -Icompat/win32
+ COMPAT_CFLAGS += -DNOGDI -Icompat/win32
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
compat/win32/trace2_win32_process_info.o \
The way we include headers in the "compat/" directory is inconsistent: - Sometimes we use includes relative to the current file. - Sometimes we use includes relative to the project root directory, which is being added via a `-I` compiler switch. - On Windows we also use includes relative to "compat/", which is being added via another platform-specific `-I` compiler switch in "compat.mak.uname". This makes it very confusing to figure out which specific file is being included right now and from what layer that file comes. Stop adding "compat/" to the Windows-specific include directories and adapt all includes in "compat/" to be relative to the projet's root directory. Despite being more consistent, it also makes it way easier to spot where an include comes from. This change also prepares for subsequent commits where we split up both "compat/mingw.h" and "compat/msvc.h". Signed-off-by: Patrick Steinhardt <ps@pks.im> --- compat/access.c | 3 ++- compat/basename.c | 4 ++-- compat/fileno.c | 2 +- compat/fopen.c | 2 +- compat/fsmonitor/fsm-health-darwin.c | 2 +- compat/fsmonitor/fsm-health-win32.c | 2 +- compat/fsmonitor/fsm-listen-darwin.c | 4 ++-- compat/fsmonitor/fsm-listen-win32.c | 2 +- compat/inet_ntop.c | 2 +- compat/inet_pton.c | 2 +- compat/memmem.c | 2 +- compat/mingw.c | 24 ++++++++++++------------ compat/mkdir.c | 2 +- compat/mkdtemp.c | 2 +- compat/mmap.c | 2 +- compat/msvc.c | 8 ++++---- compat/nonblock.c | 4 ++-- compat/obstack.c | 2 +- compat/pread.c | 4 ++-- compat/precompose_utf8.c | 2 +- compat/qsort_s.c | 2 +- compat/regcomp_enhanced.c | 2 +- compat/setenv.c | 2 +- compat/snprintf.c | 2 +- compat/strcasestr.c | 2 +- compat/strdup.c | 2 +- compat/strlcpy.c | 2 +- compat/strtoimax.c | 2 +- compat/strtoumax.c | 2 +- compat/unsetenv.c | 2 +- compat/win32/dirent.c | 2 +- compat/win32/flush.c | 2 +- compat/win32/path-utils.c | 4 ++-- compat/win32/pthread.c | 4 ++-- compat/win32/syslog.c | 2 +- compat/win32/trace2_win32_process_info.c | 10 +++++----- compat/win32mmap.c | 2 +- compat/winansi.c | 6 +++--- config.mak.uname | 4 ++-- 39 files changed, 67 insertions(+), 66 deletions(-)