Git fork

core.fsync: use batch mode and sync loose objects by default on Windows

Git for Windows has defaulted to core.fsyncObjectFiles=true since
September 2017. We turn on syncing of loose object files with batch mode
in upstream Git so that we can get broad coverage of the new code
upstream.

We don't actually do fsyncs in the most of the test suite, since
GIT_TEST_FSYNC is set to 0. However, we do exercise all of the
surrounding batch mode code since GIT_TEST_FSYNC merely makes the
maybe_fsync wrapper always appear to succeed.

Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Neeraj Singh and committed by
Junio C Hamano
8a94d833 425d290c

+10 -1
+4
cache.h
··· 1028 1028 FSYNC_COMPONENT_COMMIT_GRAPH | \ 1029 1029 FSYNC_COMPONENT_INDEX) 1030 1030 1031 + #ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT 1032 + #define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT 1033 + #endif 1034 + 1031 1035 /* 1032 1036 * A bitmask indicating which components of the repo should be fsynced. 1033 1037 */
+3
compat/mingw.h
··· 332 332 int win32_fsync_no_flush(int fd); 333 333 #define fsync_no_flush win32_fsync_no_flush 334 334 335 + #define FSYNC_COMPONENTS_PLATFORM_DEFAULT (FSYNC_COMPONENTS_DEFAULT | FSYNC_COMPONENT_LOOSE_OBJECT) 336 + #define FSYNC_METHOD_DEFAULT (FSYNC_METHOD_BATCH) 337 + 335 338 struct rlimit { 336 339 unsigned int rlim_cur; 337 340 };
+1 -1
config.c
··· 1341 1341 1342 1342 static enum fsync_component parse_fsync_components(const char *var, const char *string) 1343 1343 { 1344 - enum fsync_component current = FSYNC_COMPONENTS_DEFAULT; 1344 + enum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT; 1345 1345 enum fsync_component positive = 0, negative = 0; 1346 1346 1347 1347 while (string) {
+2
git-compat-util.h
··· 1257 1257 void BUG_fl(const char *file, int line, const char *fmt, ...); 1258 1258 #define BUG(...) BUG_fl(__FILE__, __LINE__, __VA_ARGS__) 1259 1259 1260 + #ifndef FSYNC_METHOD_DEFAULT 1260 1261 #ifdef __APPLE__ 1261 1262 #define FSYNC_METHOD_DEFAULT FSYNC_METHOD_WRITEOUT_ONLY 1262 1263 #else 1263 1264 #define FSYNC_METHOD_DEFAULT FSYNC_METHOD_FSYNC 1265 + #endif 1264 1266 #endif 1265 1267 1266 1268 enum fsync_action {