Skip to content

Commit 1b53bea

Browse files
committed
Merge branch 'js/t5351-freebsd-fix'
Some tests assumed that core.fsyncMethod=batch is supported everywhere, which broke FreeBSD. * js/t5351-freebsd-fix: t5351: avoid using `test_cmp` for binary data t5351: avoid relying on `core.fsyncMethod = batch` to be supported
2 parents 6c5fbd8 + 32ed331 commit 1b53bea

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

bulk-checkin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ void fsync_loose_object_bulk_checkin(int fd, const char *filename)
340340
*/
341341
if (!bulk_fsync_objdir ||
342342
git_fsync(fd, FSYNC_WRITEOUT_ONLY) < 0) {
343+
if (errno == ENOSYS)
344+
warning(_("core.fsyncMethod = batch is unsupported on this platform"));
343345
fsync_or_die(fd, filename);
344346
}
345347
}

t/t5351-unpack-large-objects.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,15 @@ test_expect_success 'unpack big object in stream (core.fsyncmethod=batch)' '
7070
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
7171
GIT_TEST_FSYNC=true \
7272
git -C dest.git $BATCH_CONFIGURATION unpack-objects <pack-$PACK.pack &&
73-
check_fsync_events trace2.txt <<-\EOF &&
73+
if grep "core.fsyncMethod = batch is unsupported" trace2.txt
74+
then
75+
flush_count=7
76+
else
77+
flush_count=1
78+
fi &&
79+
check_fsync_events trace2.txt <<-EOF &&
7480
"key":"fsync/writeout-only","value":"6"
75-
"key":"fsync/hardware-flush","value":"1"
81+
"key":"fsync/hardware-flush","value":"$flush_count"
7682
EOF
7783
7884
test_dir_is_empty dest.git/objects/pack &&
@@ -87,7 +93,7 @@ test_expect_success 'do not unpack existing large objects' '
8793
8894
# The destination came up with the exact same pack...
8995
DEST_PACK=$(echo dest.git/objects/pack/pack-*.pack) &&
90-
test_cmp pack-$PACK.pack $DEST_PACK &&
96+
cmp pack-$PACK.pack $DEST_PACK &&
9197
9298
# ...and wrote no loose objects
9399
test_stdout_line_count = 0 find dest.git/objects -type f ! -name "pack-*"

0 commit comments

Comments
 (0)