12
12
#include "win32/posix.h"
13
13
#include "win32/buffer.h"
14
14
#include "win32/w32_util.h"
15
+ #include "win32/version.h"
15
16
#else
16
17
#include <dirent.h>
17
18
#endif
@@ -1085,7 +1086,7 @@ int git_path_direach(
1085
1086
#if defined(GIT_WIN32 ) && !defined(__MINGW32__ )
1086
1087
1087
1088
/* Using _FIND_FIRST_EX_LARGE_FETCH may increase performance in Windows 7
1088
- * and better. Prior versions will ignore this.
1089
+ * and better.
1089
1090
*/
1090
1091
#ifndef FIND_FIRST_EX_LARGE_FETCH
1091
1092
# define FIND_FIRST_EX_LARGE_FETCH 2
@@ -1099,6 +1100,10 @@ int git_path_diriter_init(
1099
1100
git_win32_path path_filter ;
1100
1101
git_buf hack = {0 };
1101
1102
1103
+ static int is_win7_or_later = -1 ;
1104
+ if (is_win7_or_later < 0 )
1105
+ is_win7_or_later = git_has_win32_version (6 , 1 , 0 );
1106
+
1102
1107
assert (diriter && path );
1103
1108
1104
1109
memset (diriter , 0 , sizeof (git_path_diriter ));
@@ -1122,11 +1127,11 @@ int git_path_diriter_init(
1122
1127
1123
1128
diriter -> handle = FindFirstFileExW (
1124
1129
path_filter ,
1125
- FindExInfoBasic ,
1130
+ is_win7_or_later ? FindExInfoBasic : FindExInfoStandard ,
1126
1131
& diriter -> current ,
1127
1132
FindExSearchNameMatch ,
1128
1133
NULL ,
1129
- FIND_FIRST_EX_LARGE_FETCH );
1134
+ is_win7_or_later ? FIND_FIRST_EX_LARGE_FETCH : 0 );
1130
1135
1131
1136
if (diriter -> handle == INVALID_HANDLE_VALUE ) {
1132
1137
giterr_set (GITERR_OS , "Could not open directory '%s'" , path );
0 commit comments