t1005: modernize "! test -f" to "test_path_is_missing"
Replace instances of "! test -f <file>" with "test_path_is_missing <file>". This macro provides better diagnostics when the test fails (it prints "Path exists:" instead of silently failing). Signed-off-by: Tian Yuchen <a3205153416@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tian Yuchen committed
Jan 17, 2026 at 14:25 UTC
bc8556d06652c50bb0ab03dd75fe31a1909975a4
1 file changed
+5
-5
t/t1005-read-tree-reset.sh
+5
-5
@@ -40,7 +40,7 @@ test_expect_success 'reset should remove remnants from a failed merge' '
40
git ls-files -s &&
41
read_tree_u_must_succeed --reset -u HEAD &&
42
git ls-files -s >actual &&
43
- ! test -f old &&
43
+ test_path_is_missing old &&
44
test_cmp expect actual
45
'
46
@@ -56,7 +56,7 @@ test_expect_success 'two-way reset should remove remnants too' '
56
git ls-files -s &&
57
read_tree_u_must_succeed --reset -u HEAD HEAD &&
58
git ls-files -s >actual &&
59
- ! test -f old &&
59
+ test_path_is_missing old &&
60
test_cmp expect actual
61
'
62
@@ -72,7 +72,7 @@ test_expect_success 'Porcelain reset should remove remnants too' '
72
git ls-files -s &&
73
git reset --hard &&
74
git ls-files -s >actual &&
75
- ! test -f old &&
75
+ test_path_is_missing old &&
76
test_cmp expect actual
77
'
78
@@ -88,7 +88,7 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '
88
git ls-files -s &&
89
git checkout -f &&
90
git ls-files -s >actual &&
91
- ! test -f old &&
91
+ test_path_is_missing old &&
92
test_cmp expect actual
93
'
94
@@ -104,7 +104,7 @@ test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '
104
git ls-files -s &&
105
git checkout -f HEAD &&
106
git ls-files -s >actual &&
107
- ! test -f old &&
107
+ test_path_is_missing old &&
108
test_cmp expect actual
109
'
110