git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/3] compat: do not use relative paths to refer to git-compat-util.h et al

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 18, 2011, 04:32 UTC
Message-ID
<20110218043231.GD15643@elie>
In-Reply-To
<20110218042916.GC15643@elie>

Constructs like '#include "../cache.h"' referring to the toplevel of the git sources from a subdirectory make it hard to move files around. Luckily "cache.h" works from any directory because the Makefile supplies -I. in BASIC_CFLAGS explicitly.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 compat/basename.c      |    2 +-
 compat/cygwin.c        |    4 ++--
 compat/fopen.c         |    2 +-
 compat/inet_ntop.c     |    2 +-
 compat/inet_pton.c     |    2 +-
 compat/memmem.c        |    2 +-
 compat/mingw.c         |    4 ++--
 compat/mkdtemp.c       |    2 +-
 compat/mmap.c          |    2 +-
 compat/msvc.c          |    4 ++--
 compat/pread.c         |    2 +-
 compat/qsort.c         |    2 +-
 compat/setenv.c        |    2 +-
 compat/snprintf.c      |    2 +-
 compat/strcasestr.c    |    2 +-
 compat/strlcpy.c       |    2 +-
 compat/strtok_r.c      |    2 +-
 compat/strtoumax.c     |    2 +-
 compat/unsetenv.c      |    2 +-
 compat/win32/dirent.c  |    2 +-
 compat/win32/pthread.c |    2 +-
 compat/win32/syslog.c  |    4 ++--
 compat/win32mmap.c     |    2 +-
 compat/winansi.c       |    2 +-
 24 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/compat/basename.c b/compat/basename.c
index d8f8a3c..4382378 100644
--- a/compat/basename.c
+++ b/compat/basename.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /* Adapted from libiberty's basename.c.  */
 char *gitbasename (char *path)
diff --git a/compat/cygwin.c b/compat/cygwin.c
index b4a51b9..23c5138 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -1,7 +1,7 @@
 #define WIN32_LEAN_AND_MEAN
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
+#include "cache.h" /* to read configuration */
 #include "win32.h"
-#include "../cache.h" /* to read configuration */
 
 static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts)
 {
diff --git a/compat/fopen.c b/compat/fopen.c
index b5ca142..e777c44 100644
--- a/compat/fopen.c
+++ b/compat/fopen.c
@@ -9,7 +9,7 @@
  *  fopen after including git-compat-util.h is inadequate in this case.
  */
 #undef FREAD_READS_DIRECTORIES
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 FILE *git_fopen(const char *path, const char *mode)
 {
diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c
index ea249c6..d2c2b48 100644
--- a/compat/inet_ntop.c
+++ b/compat/inet_ntop.c
@@ -18,7 +18,7 @@
 #include <errno.h>
 #include <sys/types.h>
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 #include <stdio.h>
 #include <string.h>
diff --git a/compat/inet_pton.c b/compat/inet_pton.c
index 2ec995e..8ff1d9d 100644
--- a/compat/inet_pton.c
+++ b/compat/inet_pton.c
@@ -18,7 +18,7 @@
 #include <errno.h>
 #include <sys/types.h>
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 #include <stdio.h>
 #include <string.h>
diff --git a/compat/memmem.c b/compat/memmem.c
index 56bcb42..2df3e7b 100644
--- a/compat/memmem.c
+++ b/compat/memmem.c
@@ -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)
diff --git a/compat/mingw.c b/compat/mingw.c
index bee6054..e43bba3 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1,7 +1,7 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 #include "win32.h"
 #include <conio.h>
-#include "../strbuf.h"
 
 int err_win_to_posix(DWORD winerr)
 {
diff --git a/compat/mkdtemp.c b/compat/mkdtemp.c
index 1136119..4349e15 100644
--- a/compat/mkdtemp.c
+++ b/compat/mkdtemp.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 char *gitmkdtemp(char *template)
 {
diff --git a/compat/mmap.c b/compat/mmap.c
index c9d46d1..a62533e 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -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)
 {
diff --git a/compat/msvc.c b/compat/msvc.c
index 71843d7..e55b546 100644
--- a/compat/msvc.c
+++ b/compat/msvc.c
@@ -1,6 +1,6 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 #include "win32.h"
 #include <conio.h>
-#include "../strbuf.h"
 
 #include "mingw.c"
diff --git a/compat/pread.c b/compat/pread.c
index 978cac4..429f7dd 100644
--- a/compat/pread.c
+++ b/compat/pread.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
 {
diff --git a/compat/qsort.c b/compat/qsort.c
index d93dce2..a490959 100644
--- a/compat/qsort.c
+++ b/compat/qsort.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  * A merge sort implementation, simplified from the qsort implementation
diff --git a/compat/setenv.c b/compat/setenv.c
index 3a22ea7..bf1016f 100644
--- a/compat/setenv.c
+++ b/compat/setenv.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 int gitsetenv(const char *name, const char *value, int replace)
 {
diff --git a/compat/snprintf.c b/compat/snprintf.c
index e1e0e75..376eeff 100644
--- a/compat/snprintf.c
+++ b/compat/snprintf.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  * The size parameter specifies the available space, i.e. includes
diff --git a/compat/strcasestr.c b/compat/strcasestr.c
index 26896de..d666093 100644
--- a/compat/strcasestr.c
+++ b/compat/strcasestr.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 char *gitstrcasestr(const char *haystack, const char *needle)
 {
diff --git a/compat/strlcpy.c b/compat/strlcpy.c
index 4024c36..780b39f 100644
--- a/compat/strlcpy.c
+++ b/compat/strlcpy.c
@@ -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)
 {
diff --git a/compat/strtok_r.c b/compat/strtok_r.c
index 7b5d568..6eec7f8 100644
--- a/compat/strtok_r.c
+++ b/compat/strtok_r.c
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
diff --git a/compat/strtoumax.c b/compat/strtoumax.c
index 5541353..50fe26d 100644
--- a/compat/strtoumax.c
+++ b/compat/strtoumax.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 uintmax_t gitstrtoumax (const char *nptr, char **endptr, int base)
 {
diff --git a/compat/unsetenv.c b/compat/unsetenv.c
index eb29f5e..8f38d37 100644
--- a/compat/unsetenv.c
+++ b/compat/unsetenv.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 void gitunsetenv (const char *name)
 {
diff --git a/compat/win32/dirent.c b/compat/win32/dirent.c
index 7a0debe..038188e 100644
--- a/compat/win32/dirent.c
+++ b/compat/win32/dirent.c
@@ -1,4 +1,4 @@
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 #include "dirent.h"
 
 struct DIR {
diff --git a/compat/win32/pthread.c b/compat/win32/pthread.c
index 010e875..3b1f381 100644
--- a/compat/win32/pthread.c
+++ b/compat/win32/pthread.c
@@ -7,7 +7,7 @@
  * no need for double-checking.
  */
 
-#include "../../git-compat-util.h"
+#include "git-compat-util.h"
 #include "pthread.h"
 
 #include <errno.h>
diff --git a/compat/win32/syslog.c b/compat/win32/syslog.c
index 42b95a9..9c4c8e2 100644
--- a/compat/win32/syslog.c
+++ b/compat/win32/syslog.c
@@ -1,5 +1,5 @@
-#include "../../git-compat-util.h"
-#include "../../strbuf.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
 
 static HANDLE ms_eventlog;
 
diff --git a/compat/win32mmap.c b/compat/win32mmap.c
index b58aa69..756fe8a 100644
--- a/compat/win32mmap.c
+++ b/compat/win32mmap.c
@@ -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)
 {
diff --git a/compat/winansi.c b/compat/winansi.c
index dedce21..82a5d9c 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -2,7 +2,7 @@
  * Copyright 2008 Peter Harris <git@peter.is-a-geek.org>
  */
 
-#include "../git-compat-util.h"
+#include "git-compat-util.h"
 
 /*
  Functions to be wrapped:
-- 
1.7.4.1
Previous: Jonathan NiederNext: Jonathan Nieder
Message 16 of 54 in “Move test-*.c to test/ subdirectory”
  1. Move test-*.c to test/ subdirectoryNguyễn Thái Ngọc Duy, Feb 9, 2011
  2. Nguyen Thai Ngoc DuyFeb 9, 2011
  3. Junio C HamanoFeb 9, 2011
  4. Move test-* to t/helper/ subdirectoryNguyễn Thái Ngọc Duy, Feb 10, 2011
  5. 0/3 Thinning the git toplevel directoryJonathan Nieder, Feb 18, 2011
  6. 1/3 Move libgit.a sources into a libgit/ subdirectoryJonathan Nieder, Feb 18, 2011
  7. Nguyen Thai Ngoc DuyFeb 18, 2011
  8. Jonathan NiederFeb 18, 2011
  9. Jeff KingFeb 18, 2011
  10. Jonathan NiederFeb 18, 2011
  11. Nguyen Thai Ngoc DuyFeb 18, 2011
  12. 2/3 Move test-* into a test-programs/ subdirectoryJonathan Nieder, Feb 18, 2011
  13. 3/3 Move header files into a include/ subdirectoryJonathan Nieder, Feb 18, 2011
  14. Nguyen Thai Ngoc DuyFeb 18, 2011
  15. 6/3 Move remaining header files into a include/ subdirectoryJonathan Nieder, Feb 18, 2011
  16. 4/3 compat: do not use relative paths to refer to git-compat-util.h et alJonathan Nieder, Feb 18, 2011
  17. 5/3 block-sha1: do not use relative path for git-compat-util.hJonathan Nieder, Feb 18, 2011
  18. 6/3 Move git-compat-util.h, strbuf.h, and cache.h to include/Jonathan Nieder, Feb 18, 2011
  19. Nguyen Thai Ngoc DuyFeb 18, 2011
  20. 9/3 Thinning the git toplevel directoryJonathan Nieder, Feb 18, 2011
  21. 7/3 Move test-sha1.sh to test-programs/Jonathan Nieder, Feb 18, 2011
  22. 8/3 Move build helpers to scripts/ subdirectoryJonathan Nieder, Feb 18, 2011
  23. 9/3 Move non-builtin git commands and script libraries to a subdirectoryJonathan Nieder, Feb 18, 2011
  24. Jonathan NiederFeb 18, 2011
  25. Jeff KingFeb 18, 2011
  26. Jonathan NiederFeb 18, 2011
  27. Nguyen Thai Ngoc DuyFeb 18, 2011
  28. Junio C HamanoFeb 18, 2011
  29. Jonathan NiederFeb 19, 2011
  30. Sverre RabbelierFeb 19, 2011
  31. The git_remote_helpers package (Re: [RFC/PATCH 0/3] Thinning the git toplevel directory)Jonathan Nieder, Feb 19, 2011
  32. Jeff KingFeb 22, 2011
  33. Junio C HamanoFeb 22, 2011
  34. Sverre RabbelierFeb 22, 2011
  35. Jeff KingFeb 23, 2011
  36. Jonathan NiederFeb 23, 2011
  37. Jeff KingFeb 23, 2011
  38. Recursive make and variations on the themeJonathan Nieder, Feb 23, 2011
  39. Junio C HamanoFeb 23, 2011
  40. Nicolas PitreFeb 23, 2011
  41. Drew NorthupFeb 23, 2011
  42. Nicolas PitreFeb 24, 2011
  43. Drew NorthupFeb 24, 2011
  44. Nicolas PitreFeb 24, 2011
  45. Jeff KingFeb 24, 2011
  46. Drew NorthupFeb 24, 2011
  47. Piotr KrukowieckiFeb 19, 2011
  48. Junio C HamanoFeb 19, 2011
  49. Jonathan NiederFeb 19, 2011
  50. Piotr KrukowieckiFeb 19, 2011
  51. Piotr KrukowieckiFeb 19, 2011
  52. Advertising the prebuilt htmldocs and manpagesJonathan Nieder, Feb 19, 2011
  53. Junio C HamanoFeb 20, 2011
  54. Jonathan NiederFeb 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.