Skip to content

Commit 1a36188

Browse files
committed
mingw: change core.fsyncObjectFiles = 1 by default
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 <[email protected]>
1 parent fcd3b4e commit 1a36188

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compat/mingw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "gettext.h"
2121
#define SECURITY_WIN32
2222
#include <sspi.h>
23+
#include "../write-or-die.h"
2324
#include "../repository.h"
2425

2526
#define HCAST(type, handle) ((type)(intptr_t)handle)
@@ -3132,6 +3133,7 @@ int wmain(int argc, const wchar_t **wargv)
31323133
#endif
31333134

31343135
maybe_redirect_std_handles();
3136+
fsync_object_files = 1;
31353137

31363138
/* determine size of argv and environ conversion buffer */
31373139
maxlen = wcslen(wargv[0]);

0 commit comments

Comments
 (0)