Skip to content

Commit 277ce79

Browse files
avargitster
authored andcommitted
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 c859600 ([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 e5a917f (unpack-trees: don't leak memory in verify_clean_subdirectory(), 2021-10-07) and 4ea0841 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a182f69 commit 277ce79

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

t/t1001-read-tree-m-2way.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ In the test, these paths are used:
2121
yomin - not in H or M
2222
'
2323

24-
TEST_PASSES_SANITIZE_LEAK=true
2524
. ./test-lib.sh
2625
. "$TEST_DIRECTORY"/lib-read-tree.sh
2726

@@ -38,11 +37,12 @@ compare_change () {
3837
}
3938

4039
check_cache_at () {
41-
clean_if_empty=$(git diff-files -- "$1")
40+
git diff-files -- "$1" >out &&
41+
clean_if_empty=$(cat out) &&
4242
case "$clean_if_empty" in
4343
'') echo "$1: clean" ;;
4444
?*) echo "$1: dirty" ;;
45-
esac
45+
esac &&
4646
case "$2,$clean_if_empty" in
4747
clean,) : ;;
4848
clean,?*) false ;;

t/t1002-read-tree-m-u-2way.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ This is identical to t1001, but uses -u to update the work tree as well.
99
1010
'
1111

12-
TEST_PASSES_SANITIZE_LEAK=true
1312
. ./test-lib.sh
1413
. "$TEST_DIRECTORY"/lib-read-tree.sh
1514

@@ -23,11 +22,12 @@ compare_change () {
2322
}
2423

2524
check_cache_at () {
26-
clean_if_empty=$(git diff-files -- "$1")
25+
git diff-files -- "$1" >out &&
26+
clean_if_empty=$(cat out) &&
2727
case "$clean_if_empty" in
2828
'') echo "$1: clean" ;;
2929
?*) echo "$1: dirty" ;;
30-
esac
30+
esac &&
3131
case "$2,$clean_if_empty" in
3232
clean,) : ;;
3333
clean,?*) false ;;

0 commit comments

Comments
 (0)