]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t7003: modernize path existence checks using test helpers
authorSoutrikDas <valusoutrik@gmail.com>
Mon, 9 Feb 2026 17:24:45 +0000 (22:54 +0530)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Feb 2026 18:16:01 +0000 (10:16 -0800)
Replace direct uses of 'test -f' and 'test -d' with
git's helper functions 'test_path_is_file' ,
'test_path_is_missing' and 'test_path_is_dir'

Signed-off-by: SoutrikDas <valusoutrik@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7003-filter-branch.sh

index 5ab4d41ee7c6b122b8601bf8059eecafdf081c39..c4757698589bc9dce5f00dfd1476684f138eb17b 100755 (executable)
@@ -92,8 +92,8 @@ test_expect_success 'rewrite, renaming a specific file' '
 
 test_expect_success 'test that the file was renamed' '
        test D = "$(git show HEAD:doh --)" &&
-       ! test -f D.t &&
-       test -f doh &&
+       test_path_is_missing D.t &&
+       test_path_is_file doh &&
        test D = "$(cat doh)"
 '
 
@@ -103,10 +103,10 @@ test_expect_success 'rewrite, renaming a specific directory' '
 
 test_expect_success 'test that the directory was renamed' '
        test dir/D = "$(git show HEAD:diroh/D.t --)" &&
-       ! test -d dir &&
-       test -d diroh &&
-       ! test -d diroh/dir &&
-       test -f diroh/D.t &&
+       test_path_is_missing dir &&
+       test_path_is_dir diroh &&
+       test_path_is_missing diroh/dir &&
+       test_path_is_file diroh/D.t &&
        test dir/D = "$(cat diroh/D.t)"
 '