Skip to content

Commit

Permalink
Merge branch 'js/t5351-freebsd-fix'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gitster committed Aug 8, 2022
2 parents 6c5fbd8 + 32ed331 commit 1b53bea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions bulk-checkin.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ void fsync_loose_object_bulk_checkin(int fd, const char *filename)
*/
if (!bulk_fsync_objdir ||
git_fsync(fd, FSYNC_WRITEOUT_ONLY) < 0) {
if (errno == ENOSYS)
warning(_("core.fsyncMethod = batch is unsupported on this platform"));
fsync_or_die(fd, filename);
}
}
Expand Down
12 changes: 9 additions & 3 deletions t/t5351-unpack-large-objects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@ test_expect_success 'unpack big object in stream (core.fsyncmethod=batch)' '
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
GIT_TEST_FSYNC=true \
git -C dest.git $BATCH_CONFIGURATION unpack-objects <pack-$PACK.pack &&
check_fsync_events trace2.txt <<-\EOF &&
if grep "core.fsyncMethod = batch is unsupported" trace2.txt
then
flush_count=7
else
flush_count=1
fi &&
check_fsync_events trace2.txt <<-EOF &&
"key":"fsync/writeout-only","value":"6"
"key":"fsync/hardware-flush","value":"1"
"key":"fsync/hardware-flush","value":"$flush_count"
EOF
test_dir_is_empty dest.git/objects/pack &&
Expand All @@ -87,7 +93,7 @@ test_expect_success 'do not unpack existing large objects' '
# The destination came up with the exact same pack...
DEST_PACK=$(echo dest.git/objects/pack/pack-*.pack) &&
test_cmp pack-$PACK.pack $DEST_PACK &&
cmp pack-$PACK.pack $DEST_PACK &&
# ...and wrote no loose objects
test_stdout_line_count = 0 find dest.git/objects -type f ! -name "pack-*"
Expand Down

0 comments on commit 1b53bea

Please sign in to comment.