Skip to content

Commit 32ed331

Browse files
dschogitster
authored andcommitted
t5351: avoid using test_cmp for binary data
The `test_cmp` function is meant to provide nicer output than `cmp` when expected and actual output of Git commands disagree. The implicit assumption is that the output is line-based and human readable. However, aaf8122 (unpack-objects: use stream_loose_object() to unpack large objects, 2022-06-11) introduced a call that compares the contents of pack files, which are distinctly not line-based nor human readable. This causes problems because on Windows, we hand off to the Bash function `mingw_test_cmp` that compares the lines while ignoring line ending differences. And this Bash function spends an insane amount of cycles trying to read in that binary pack file, so that it is almost indistinguishable from an infinite loop. For example, t5351 took 1486 seconds in the CI run at https://github.com/git/git/runs/7398490747?check_suite_focus=true#step:5:171, to complete. And yes, that is almost half an hour. Since Git's tests already use `cmp` consistently when comparing pack files, let's change this instance to use `cmp` instead of `test_cmp`, too, and fix that performance problem. Now t5351 takes all of 22 seconds. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ce50f1f commit 32ed331

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/t5351-unpack-large-objects.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ test_expect_success 'do not unpack existing large objects' '
9393
9494
# The destination came up with the exact same pack...
9595
DEST_PACK=$(echo dest.git/objects/pack/pack-*.pack) &&
96-
test_cmp pack-$PACK.pack $DEST_PACK &&
96+
cmp pack-$PACK.pack $DEST_PACK &&
9797
9898
# ...and wrote no loose objects
9999
test_stdout_line_count = 0 find dest.git/objects -type f ! -name "pack-*"

0 commit comments

Comments
 (0)