@@ -6,7 +6,7 @@ use constant rev_map_fmt => 'NH*';
66use vars qw/ $_no_metadata
77 $_repack $_repack_flags $_use_svm_props $_head
88 $_use_svnsync_props $no_reuse_existing
9- $_use_log_author $_add_author_from $_localtime/ ;
9+ $_use_log_author $_add_author_from $_localtime $_use_fsync / ;
1010use Carp qw/ croak/ ;
1111use File::Path qw/ mkpath/ ;
1212use IPC::Open3;
@@ -2269,6 +2269,19 @@ sub mkfile {
22692269 }
22702270}
22712271
2272+ # TODO: move this to Git.pm?
2273+ sub use_fsync {
2274+ if (!defined ($_use_fsync)) {
2275+ my $x = $ENV {GIT_TEST_FSYNC };
2276+ if (defined $x ) {
2277+ my $v = command_oneline(' -c' , " test.fsync=$x " ,
2278+ qw( config --type=bool test.fsync) );
2279+ $_use_fsync = defined ($v ) ? ($v eq " true\n " ) : 1;
2280+ }
2281+ }
2282+ $_use_fsync;
2283+ }
2284+
22722285sub rev_map_set {
22732286 my ($self , $rev , $commit , $update_ref , $uuid ) = @_ ;
22742287 defined $commit or die " missing arg3\n " ;
@@ -2290,7 +2303,7 @@ sub rev_map_set {
22902303 my $sync ;
22912304 # both of these options make our .rev_db file very, very important
22922305 # and we can't afford to lose it because rebuild() won't work
2293- if ($self -> use_svm_props || $self -> no_metadata) {
2306+ if (( $self -> use_svm_props || $self -> no_metadata) && use_fsync() ) {
22942307 require File::Copy;
22952308 $sync = 1;
22962309 File::Copy::copy($db , $db_lock ) or die " rev_map_set(@_ ): " ,
0 commit comments