read-tree tests: check "diff-files" exit code on failure

Fix an issue with the exit code of "diff-files" being ignored, which has been ignored ever since these tests were originally added in c859600954d ([PATCH] read-tree: save more user hassles during fast-forward., 2005-06-07). Since the exit code was ignored we'd hide errors here under SANITIZE=leak, which resulted in me mistakenly marking these tests as passing under SANITIZE=leak in e5a917fcf42 (unpack-trees: don't leak memory in verify_clean_subdirectory(), 2021-10-07) and 4ea08416b8e (leak tests: mark a read-tree test as passing SANITIZE=leak, 2021-10-31). As it would be non-trivial to fix these tests (the leak is in revision.c) let's un-mark them as passing under SANITIZE=leak in addition to fixing the issue of ignoring the exit code. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Mar 7, 2022 at 13:48 UTC 277ce7961d3c01c77b16fe4f751672b855b087fb
2 files changed +6 -6
t/t1001-read-tree-m-2way.sh
+3 -3
@@ -21,7 +21,6 @@ In the test, these paths are used:
21 yomin - not in H or M
22 '
23
24 -TEST_PASSES_SANITIZE_LEAK=true
24 . ./test-lib.sh
25 . "$TEST_DIRECTORY"/lib-read-tree.sh
26
@@ -38,11 +37,12 @@ compare_change () {
37 }
38
39 check_cache_at () {
41 - clean_if_empty=$(git diff-files -- "$1")
40 + git diff-files -- "$1" >out &&
41 + clean_if_empty=$(cat out) &&
42 case "$clean_if_empty" in
43 '') echo "$1: clean" ;;
44 ?*) echo "$1: dirty" ;;
45 - esac
45 + esac &&
46 case "$2,$clean_if_empty" in
47 clean,) : ;;
48 clean,?*) false ;;
t/t1002-read-tree-m-u-2way.sh
+3 -3
@@ -9,7 +9,6 @@ This is identical to t1001, but uses -u to update the work tree as well.
9
10 '
11
12 -TEST_PASSES_SANITIZE_LEAK=true
12 . ./test-lib.sh
13 . "$TEST_DIRECTORY"/lib-read-tree.sh
14
@@ -23,11 +22,12 @@ compare_change () {
22 }
23
24 check_cache_at () {
26 - clean_if_empty=$(git diff-files -- "$1")
25 + git diff-files -- "$1" >out &&
26 + clean_if_empty=$(cat out) &&
27 case "$clean_if_empty" in
28 '') echo "$1: clean" ;;
29 ?*) echo "$1: dirty" ;;
30 - esac
30 + esac &&
31 case "$2,$clean_if_empty" in
32 clean,) : ;;
33 clean,?*) false ;;