Skip to contentSkip to conversation

t1001: replace 'test -f' with 'test_path_is_file'

PATCH In review Rodrigo Carvalho 2 participants 2 messages May 10, 2025 – May 12, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t1001: replace 'test -f' with 'test_path_is_file'

'test_path_is_file' is a modern path checking method in Git's development.
Replace the basic shell command 'test -f' with this approach.

---
 t/t1001-read-tree-m-2way.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/t1001-read-tree-m-2way.sh +1 -1
index 4a88bb9ef0..2e8d9384e1 100755
@@ -362,7 +362,7 @@ test_expect_success 'a/b (untracked) vs a case setup.' '
 test_expect_success 'a/b (untracked) vs a, plus c/d case test.' '
 	read_tree_u_must_fail -u -m "$treeH" "$treeM" &&
 	git ls-files --stage &&
-	test -f a/b
+	test_path_is_file a/b
 '
 
 test_expect_success 'read-tree supports the super-prefix' '
Signature · 1 line
2.43.0
#1 lore raw
Quoted 13 lines · Rodrigo Carvalho

'test_path_is_file' is a modern path checking method in Git's development.
Replace the basic shell command 'test -f' with this approach.

---
 t/t1001-read-tree-m-2way.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/t1001-read-tree-m-2way.sh +0 -0
index 4a88bb9ef0..2e8d9384e1 100755

t/t1001-read-tree-m-2way.sh test_expect_success 'a/b (untracked) vs a case setup.' ' · line 366

Quoted 6 lines
t/t1001-read-tree-m-2way.sh +1 -1
@@ -362,7 +362,7 @@ test_expect_success 'a/b (untracked) vs a case setup.' '
 test_expect_success 'a/b (untracked) vs a, plus c/d case test.' '
 	read_tree_u_must_fail -u -m "$treeH" "$treeM" &&
 	git ls-files --stage &&
-	test -f a/b
+	test_path_is_file a/b
 '

Obviously correct conversion.

This is an ancient part of the system, started before we even had a "git checkout" rewritten as a single command, so it is not surprising if it had quite a lot of antiquities and debugging statement without much effect, which may be subject to further clean-up.

Thanks, will queue.