]> git.ipfire.org Git - thirdparty/git.git/blobdiff - perl/Git/SVN.pm
Merge branch 'rs/parse-options-with-keep-unknown-abbrev-fix'
[thirdparty/git.git] / perl / Git / SVN.pm
index 35ff5a68963db935c48b1113e0da14361f8ad246..7721708ce5d7f6560ba9f84706e9ad840664020a 100644 (file)
@@ -6,7 +6,7 @@ use constant rev_map_fmt => 'NH*';
 use vars qw/$_no_metadata
             $_repack $_repack_flags $_use_svm_props $_head
             $_use_svnsync_props $no_reuse_existing
-           $_use_log_author $_add_author_from $_localtime/;
+           $_use_log_author $_add_author_from $_localtime $_use_fsync/;
 use Carp qw/croak/;
 use File::Path qw/mkpath/;
 use IPC::Open3;
@@ -1752,7 +1752,7 @@ sub tie_for_persistent_memoization {
 END {
        # Force cache writeout explicitly instead of waiting for
        # global destruction to avoid segfault in Storable:
-       # http://rt.cpan.org/Public/Bug/Display.html?id=36087
+       # https://rt.cpan.org/Public/Bug/Display.html?id=36087
        unmemoize_svn_mergeinfo_functions();
 }
 
@@ -2269,6 +2269,19 @@ sub mkfile {
        }
 }
 
+# TODO: move this to Git.pm?
+sub use_fsync {
+       if (!defined($_use_fsync)) {
+               my $x = $ENV{GIT_TEST_FSYNC};
+               if (defined $x) {
+                       my $v = command_oneline('-c', "test.fsync=$x",
+                                       qw(config --type=bool test.fsync));
+                       $_use_fsync = defined($v) ? ($v eq "true\n") : 1;
+               }
+       }
+       $_use_fsync;
+}
+
 sub rev_map_set {
        my ($self, $rev, $commit, $update_ref, $uuid) = @_;
        defined $commit or die "missing arg3\n";
@@ -2290,7 +2303,7 @@ sub rev_map_set {
        my $sync;
        # both of these options make our .rev_db file very, very important
        # and we can't afford to lose it because rebuild() won't work
-       if ($self->use_svm_props || $self->no_metadata) {
+       if (($self->use_svm_props || $self->no_metadata) && use_fsync()) {
                require File::Copy;
                $sync = 1;
                File::Copy::copy($db, $db_lock) or die "rev_map_set(@_): ",