summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Strickroth <email@cs-ware.de>2015-07-21 23:36:39 +0200
committerSven Strickroth <email@cs-ware.de>2015-07-22 12:52:24 +0200
commit318bb763e9e896472e2aa16ebe8cbf2463804e19 (patch)
tree4923e5a12d3c77fe1d569d9136d7413f1fff3f29
parent42156d561723e92ffe597885719aa63abfe0795c (diff)
downloadlibgit2-318bb763e9e896472e2aa16ebe8cbf2463804e19.tar.gz
Make libgit2 work on Windows Vista again
(fixes issue #3316) Signed-off-by: Sven Strickroth <email@cs-ware.de>
-rw-r--r--src/path.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/path.c b/src/path.c
index 2558058dd..3e63f06d4 100644
--- a/src/path.c
+++ b/src/path.c
@@ -12,6 +12,7 @@
#include "win32/posix.h"
#include "win32/buffer.h"
#include "win32/w32_util.h"
+#include "win32/version.h"
#else
#include <dirent.h>
#endif
@@ -1085,7 +1086,7 @@ int git_path_direach(
#if defined(GIT_WIN32) && !defined(__MINGW32__)
/* Using _FIND_FIRST_EX_LARGE_FETCH may increase performance in Windows 7
- * and better. Prior versions will ignore this.
+ * and better.
*/
#ifndef FIND_FIRST_EX_LARGE_FETCH
# define FIND_FIRST_EX_LARGE_FETCH 2
@@ -1099,6 +1100,10 @@ int git_path_diriter_init(
git_win32_path path_filter;
git_buf hack = {0};
+ static int is_win7_or_later = -1;
+ if (is_win7_or_later < 0)
+ is_win7_or_later = git_has_win32_version(6, 1, 0);
+
assert(diriter && path);
memset(diriter, 0, sizeof(git_path_diriter));
@@ -1122,11 +1127,11 @@ int git_path_diriter_init(
diriter->handle = FindFirstFileExW(
path_filter,
- FindExInfoBasic,
+ is_win7_or_later ? FindExInfoBasic : FindExInfoStandard,
&diriter->current,
FindExSearchNameMatch,
NULL,
- FIND_FIRST_EX_LARGE_FETCH);
+ is_win7_or_later ? FIND_FIRST_EX_LARGE_FETCH : 0);
if (diriter->handle == INVALID_HANDLE_VALUE) {
giterr_set(GITERR_OS, "Could not open directory '%s'", path);