From 9dfd43ae5900b7508e068f766f575a70b0039e8f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 4 Sep 2017 11:59:45 +0200 Subject: [PATCH] mingw: change core.fsyncObjectFiles = 1 by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From the documentation of said setting: This boolean will enable fsync() when writing object files. This is a total waste of time and effort on a filesystem that orders data writes properly, but can be useful for filesystems that do not use journalling (traditional UNIX filesystems) or that only journal metadata and not file contents (OS X’s HFS+, or Linux ext3 with "data=writeback"). The most common file system on Windows (NTFS) does not guarantee that order, therefore a sudden loss of power (or any other event causing an unclean shutdown) would cause corrupt files (i.e. files filled with NULs). Therefore we need to change the default. Note that the documentation makes it sound as if this causes really bad performance. In reality, writing loose objects is something that is done only rarely, and only a handful of files at a time. Signed-off-by: Johannes Schindelin --- compat/mingw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compat/mingw.c b/compat/mingw.c index 5e4f224247..9d6baad6d1 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -3077,6 +3077,7 @@ int msc_startup(int argc, wchar_t **w_argv, wchar_t **w_env) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif + fsync_object_files = 1; maybe_redirect_std_handles(); /* determine size of argv conversion buffer */ @@ -3143,6 +3144,7 @@ void mingw_startup(void) wchar_t **wenv, **wargv; _startupinfo si; + fsync_object_files = 1; maybe_redirect_std_handles(); /* get wide char arguments and environment */