Commit 451df7930db432e7b251bbd0fe2862fe96424ae9

Patrick Steinhardt 2019-06-13T15:20:23

posix: remove implicit include of "fnmatch.h" We're about to phase out our bundled fnmatch implementation as git.git has moved to wildmatch long ago in 2014. To make it easier to spot which files are stilll using fnmatch, remove the implicit "fnmatch.h" include in "posix.h" and instead include it explicitly.

diff --git a/src/attr_file.c b/src/attr_file.c
index f01a743..a2959ae 100644
--- a/src/attr_file.c
+++ b/src/attr_file.c
@@ -15,6 +15,7 @@
 #include "git2/tree.h"
 #include "blob.h"
 #include "index.h"
+#include "fnmatch.h"
 #include <ctype.h>
 
 static void attr_file_free(git_attr_file *file)
diff --git a/src/config_file.c b/src/config_file.c
index 7162058..958a163 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -18,6 +18,7 @@
 #include "array.h"
 #include "config_parse.h"
 #include "config_entries.h"
+#include "fnmatch.h"
 
 #include <ctype.h>
 #include <sys/types.h>
diff --git a/src/describe.c b/src/describe.c
index 7f71519..1354290 100644
--- a/src/describe.c
+++ b/src/describe.c
@@ -14,12 +14,13 @@
 
 #include "commit.h"
 #include "commit_list.h"
+#include "fnmatch.h"
 #include "oidmap.h"
 #include "refs.h"
+#include "repository.h"
 #include "revwalk.h"
 #include "tag.h"
 #include "vector.h"
-#include "repository.h"
 
 /* Ported from https://github.com/git/git/blob/89dde7882f71f846ccd0359756d27bebc31108de/builtin/describe.c */
 
diff --git a/src/pathspec.c b/src/pathspec.c
index 07795f2..80144c7 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -16,6 +16,7 @@
 #include "index.h"
 #include "bitvec.h"
 #include "diff.h"
+#include "fnmatch.h"
 
 /* what is the common non-wildcard prefix for all items in the pathspec */
 char *git_pathspec_prefix(const git_strarray *pathspec)
diff --git a/src/posix.h b/src/posix.h
index 0119b6b..2296666 100644
--- a/src/posix.h
+++ b/src/posix.h
@@ -11,7 +11,6 @@
 
 #include <fcntl.h>
 #include <time.h>
-#include "fnmatch.h"
 
 /* stat: file mode type testing macros */
 #ifndef S_IFGITLINK
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index c8533e6..22b08a1 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -18,6 +18,7 @@
 #include "iterator.h"
 #include "sortedcache.h"
 #include "signature.h"
+#include "fnmatch.h"
 
 #include <git2/tag.h>
 #include <git2/object.h>
diff --git a/src/refspec.c b/src/refspec.c
index dab0536..30e618f 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -10,7 +10,7 @@
 #include "git2/errors.h"
 
 #include "util.h"
-#include "posix.h"
+#include "fnmatch.h"
 #include "refs.h"
 #include "vector.h"
 
diff --git a/src/status.c b/src/status.c
index 8d3185f..84c4b66 100644
--- a/src/status.c
+++ b/src/status.c
@@ -16,6 +16,7 @@
 #include "repository.h"
 #include "ignore.h"
 #include "index.h"
+#include "fnmatch.h"
 
 #include "git2/diff.h"
 #include "diff.h"
diff --git a/src/tag.c b/src/tag.c
index b4a5015..e39a79c 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -8,6 +8,7 @@
 #include "tag.h"
 
 #include "commit.h"
+#include "fnmatch.h"
 #include "signature.h"
 #include "message.h"
 #include "git2/object.h"
diff --git a/tests/describe/describe_helpers.c b/tests/describe/describe_helpers.c
index 2e6ad53..e8e887c 100644
--- a/tests/describe/describe_helpers.c
+++ b/tests/describe/describe_helpers.c
@@ -1,5 +1,7 @@
 #include "describe_helpers.h"
 
+#include "fnmatch.h"
+
 void assert_describe(
 	const char *expected_output,
 	const char *revparse_spec,