diff --git a/Bindings/Libgit2/Repository.hsc b/Bindings/Libgit2/Repository.hsc
--- a/Bindings/Libgit2/Repository.hsc
+++ b/Bindings/Libgit2/Repository.hsc
@@ -15,6 +15,7 @@
 #num GIT_REPOSITORY_OPEN_NO_SEARCH
 #num GIT_REPOSITORY_OPEN_CROSS_FS
 #ccall git_repository_open_ext , Ptr (Ptr <git_repository>) -> CString -> CUInt -> CString -> IO (CInt)
+#ccall git_repository_new , Ptr (Ptr <git_repository>) -> IO (CInt)
 #ccall git_repository_free , Ptr <git_repository> -> IO ()
 #ccall git_repository_init , Ptr (Ptr <git_repository>) -> CString -> CUInt -> IO (CInt)
 #ccall git_repository_head , Ptr (Ptr <git_reference>) -> Ptr <git_repository> -> IO (CInt)
diff --git a/hlibgit2.cabal b/hlibgit2.cabal
--- a/hlibgit2.cabal
+++ b/hlibgit2.cabal
@@ -1,7 +1,7 @@
 Name:                hlibgit2
-Version:             0.17.0.2
-Synopsis:            Low-level bindings to libgit2.
-Description:         Bindings to libgit2 v0.17.0
+Version:             0.17.0.3
+Synopsis:            Low-level bindings to libgit2
+Description:         Bindings to libgit2 v0.17.0.
 License-file:        LICENSE
 License:             MIT
 Author:              John Wiegley, Sakari Jokinen, Jacob Stanleyyeah,
@@ -15,6 +15,7 @@
   libgit2/include/git2.h
   libgit2/include/git2/*.h
   libgit2/src/*.h
+  libgit2/src/compat/*.h
   libgit2/src/unix/*.h
   libgit2/src/win32/*.h
   libgit2/src/xdiff/*.h
@@ -174,6 +175,7 @@
     include-dirs:
       libgit2/src/win32
   else
+    cc-options: -D_GNU_SOURCE
     c-sources:
       libgit2/src/unix/map.c
     include-dirs:
diff --git a/libgit2/include/git2/repository.h b/libgit2/include/git2/repository.h
--- a/libgit2/include/git2/repository.h
+++ b/libgit2/include/git2/repository.h
@@ -85,6 +85,14 @@
 	const char *ceiling_dirs);
 
 /**
+ * Create a new repository with neither backends nor config object
+ *
+ * Note that this is only useful if you wish to associate the repository
+ * with a non-filesystem-backed object database and config store.
+ */
+GIT_EXTERN(int) git_repository_new(git_repository **out);
+
+/**
  * Free a previously allocated repository
  *
  * Note that after a repository is free'd, all the objects it has spawned
diff --git a/libgit2/src/compat/fnmatch.h b/libgit2/src/compat/fnmatch.h
new file mode 100644
--- /dev/null
+++ b/libgit2/src/compat/fnmatch.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2009-2012 the libgit2 contributors
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+#ifndef INCLUDE_fnmatch__compat_h__
+#define INCLUDE_fnmatch__compat_h__
+
+#include "common.h"
+
+#define FNM_NOMATCH		1		/* Match failed. */
+#define FNM_NOSYS		2		/* Function not supported (unused). */
+
+#define FNM_NOESCAPE		0x01		/* Disable backslash escaping. */
+#define FNM_PATHNAME		0x02		/* Slash must be matched by slash. */
+#define FNM_PERIOD		0x04		/* Period must be matched by period. */
+#define FNM_LEADING_DIR 0x08		/* Ignore /<tail> after Imatch. */
+#define FNM_CASEFOLD		0x10		/* Case insensitive search. */
+
+#define FNM_IGNORECASE	FNM_CASEFOLD
+#define FNM_FILE_NAME	FNM_PATHNAME
+
+extern int p_fnmatch(const char *pattern, const char *string, int flags);
+
+#endif /* _FNMATCH_H */
+
diff --git a/libgit2/src/repository.c b/libgit2/src/repository.c
--- a/libgit2/src/repository.c
+++ b/libgit2/src/repository.c
@@ -116,6 +116,12 @@
 	return repo;
 }
 
+int git_repository_new(git_repository **out)
+{
+	*out = repository_alloc();
+	return 0;
+}
+
 static int load_config_data(git_repository *repo)
 {
 	int is_bare;
