@@ -1149,7 +1149,7 @@ test_expect_code () {
11491149
11501150test_cmp () {
11511151 test " $# " -ne 2 && BUG " 2 param"
1152- eval " $GIT_TEST_CMP " ' "$@"'
1152+ GIT_ALLOC_LIMIT=0 eval " $GIT_TEST_CMP " ' "$@"'
11531153}
11541154
11551155# Check that the given config key has the expected value.
@@ -1450,72 +1450,6 @@ test_skip_or_die () {
14501450 error " $2 "
14511451}
14521452
1453- # The following mingw_* functions obey POSIX shell syntax, but are actually
1454- # bash scripts, and are meant to be used only with bash on Windows.
1455-
1456- # A test_cmp function that treats LF and CRLF equal and avoids to fork
1457- # diff when possible.
1458- mingw_test_cmp () {
1459- # Read text into shell variables and compare them. If the results
1460- # are different, use regular diff to report the difference.
1461- local test_cmp_a= test_cmp_b=
1462-
1463- # When text came from stdin (one argument is '-') we must feed it
1464- # to diff.
1465- local stdin_for_diff=
1466-
1467- # Since it is difficult to detect the difference between an
1468- # empty input file and a failure to read the files, we go straight
1469- # to diff if one of the inputs is empty.
1470- if test -s " $1 " && test -s " $2 "
1471- then
1472- # regular case: both files non-empty
1473- mingw_read_file_strip_cr_ test_cmp_a < " $1 "
1474- mingw_read_file_strip_cr_ test_cmp_b < " $2 "
1475- elif test -s " $1 " && test " $2 " = -
1476- then
1477- # read 2nd file from stdin
1478- mingw_read_file_strip_cr_ test_cmp_a < " $1 "
1479- mingw_read_file_strip_cr_ test_cmp_b
1480- stdin_for_diff=' <<<"$test_cmp_b"'
1481- elif test " $1 " = - && test -s " $2 "
1482- then
1483- # read 1st file from stdin
1484- mingw_read_file_strip_cr_ test_cmp_a
1485- mingw_read_file_strip_cr_ test_cmp_b < " $2 "
1486- stdin_for_diff=' <<<"$test_cmp_a"'
1487- fi
1488- test -n " $test_cmp_a " &&
1489- test -n " $test_cmp_b " &&
1490- test " $test_cmp_a " = " $test_cmp_b " ||
1491- eval " diff -u \"\$ @\" $stdin_for_diff "
1492- }
1493-
1494- # $1 is the name of the shell variable to fill in
1495- mingw_read_file_strip_cr_ () {
1496- # Read line-wise using LF as the line separator
1497- # and use IFS to strip CR.
1498- local line
1499- while :
1500- do
1501- if IFS=$' \r ' read -r -d $' \n ' line
1502- then
1503- # good
1504- line=$line $' \n '
1505- else
1506- # we get here at EOF, but also if the last line
1507- # was not terminated by LF; in the latter case,
1508- # some text was read
1509- if test -z " $line "
1510- then
1511- # EOF, really
1512- break
1513- fi
1514- fi
1515- eval " $1 =\$ $1 \$ line"
1516- done
1517- }
1518-
15191453# Like "env FOO=BAR some-program", but run inside a subshell, which means
15201454# it also works for shell functions (though those functions cannot impact
15211455# the environment outside of the test_env invocation).
0 commit comments