]> git.ipfire.org Git - thirdparty/git.git/blobdiff - write-or-die.c
refs: print error message in debug output
[thirdparty/git.git] / write-or-die.c
index 0b1ec8190b622d18751aef3d0e640bf3d0e63b97..a3d5784cec94230d18747612bfe59e8db8248ff9 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "config.h"
 #include "run-command.h"
 
 /*
@@ -57,6 +58,10 @@ void fprintf_or_die(FILE *f, const char *fmt, ...)
 
 void fsync_or_die(int fd, const char *msg)
 {
+       if (use_fsync < 0)
+               use_fsync = git_env_bool("GIT_TEST_FSYNC", 1);
+       if (!use_fsync)
+               return;
        while (fsync(fd) < 0) {
                if (errno != EINTR)
                        die_errno("fsync error on '%s'", msg);