aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-02-17 13:30:42 -0800
committerJunio C Hamano <gitster@pobox.com>2026-02-17 13:30:43 -0800
commit70d3916a7db5233ce01f2f3f36ee04d57c0f9252 (patch)
treed1d3e5b37ad884ab3622b4d3d6a805636073709a
parent83037cb3576393ef8abba34a2881e704fa42c7a8 (diff)
parent168d575719d944759964e004d17a3282b0f883d5 (diff)
downloadgit-70d3916a7db5233ce01f2f3f36ee04d57c0f9252.tar.xz
Merge branch 'bk/t2003-modernise'
Test update. * bk/t2003-modernise: t2003: modernize path existence checks using test helpers
-rwxr-xr-xt/t2003-checkout-cache-mkdir.sh50
1 files changed, 25 insertions, 25 deletions
diff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh
index ff163cf675..19166adf0f 100755
--- a/t/t2003-checkout-cache-mkdir.sh
+++ b/t/t2003-checkout-cache-mkdir.sh
@@ -24,27 +24,28 @@ test_expect_success SYMLINKS 'have symlink in place where dir is expected.' '
mkdir path2 &&
ln -s path2 path1 &&
git checkout-index -f -a &&
- test ! -h path1 && test -d path1 &&
- test -f path1/file1 && test ! -f path2/file1
+ test_path_is_dir_not_symlink path1 &&
+ test_path_is_file path1/file1 &&
+ test_path_is_missing path2/file1
'
test_expect_success 'use --prefix=path2/' '
rm -fr path0 path1 path2 &&
mkdir path2 &&
git checkout-index --prefix=path2/ -f -a &&
- test -f path2/path0 &&
- test -f path2/path1/file1 &&
- test ! -f path0 &&
- test ! -f path1/file1
+ test_path_is_file path2/path0 &&
+ test_path_is_file path2/path1/file1 &&
+ test_path_is_missing path0 &&
+ test_path_is_missing path1/file1
'
test_expect_success 'use --prefix=tmp-' '
rm -fr path0 path1 path2 tmp* &&
git checkout-index --prefix=tmp- -f -a &&
- test -f tmp-path0 &&
- test -f tmp-path1/file1 &&
- test ! -f path0 &&
- test ! -f path1/file1
+ test_path_is_file tmp-path0 &&
+ test_path_is_file tmp-path1/file1 &&
+ test_path_is_missing path0 &&
+ test_path_is_missing path1/file1
'
test_expect_success 'use --prefix=tmp- but with a conflicting file and dir' '
@@ -52,10 +53,10 @@ test_expect_success 'use --prefix=tmp- but with a conflicting file and dir' '
echo nitfol >tmp-path1 &&
mkdir tmp-path0 &&
git checkout-index --prefix=tmp- -f -a &&
- test -f tmp-path0 &&
- test -f tmp-path1/file1 &&
- test ! -f path0 &&
- test ! -f path1/file1
+ test_path_is_file tmp-path0 &&
+ test_path_is_file tmp-path1/file1 &&
+ test_path_is_missing path0 &&
+ test_path_is_missing path1/file1
'
test_expect_success SYMLINKS 'use --prefix=tmp/orary/ where tmp is a symlink' '
@@ -63,10 +64,10 @@ test_expect_success SYMLINKS 'use --prefix=tmp/orary/ where tmp is a symlink' '
mkdir tmp1 tmp1/orary &&
ln -s tmp1 tmp &&
git checkout-index --prefix=tmp/orary/ -f -a &&
- test -d tmp1/orary &&
- test -f tmp1/orary/path0 &&
- test -f tmp1/orary/path1/file1 &&
- test -h tmp
+ test_path_is_dir tmp1/orary &&
+ test_path_is_file tmp1/orary/path0 &&
+ test_path_is_file tmp1/orary/path1/file1 &&
+ test_path_is_symlink tmp
'
test_expect_success SYMLINKS 'use --prefix=tmp/orary- where tmp is a symlink' '
@@ -74,9 +75,9 @@ test_expect_success SYMLINKS 'use --prefix=tmp/orary- where tmp is a symlink' '
mkdir tmp1 &&
ln -s tmp1 tmp &&
git checkout-index --prefix=tmp/orary- -f -a &&
- test -f tmp1/orary-path0 &&
- test -f tmp1/orary-path1/file1 &&
- test -h tmp
+ test_path_is_file tmp1/orary-path0 &&
+ test_path_is_file tmp1/orary-path1/file1 &&
+ test_path_is_symlink tmp
'
test_expect_success SYMLINKS 'use --prefix=tmp- where tmp-path1 is a symlink' '
@@ -84,10 +85,9 @@ test_expect_success SYMLINKS 'use --prefix=tmp- where tmp-path1 is a symlink' '
mkdir tmp1 &&
ln -s tmp1 tmp-path1 &&
git checkout-index --prefix=tmp- -f -a &&
- test -f tmp-path0 &&
- test ! -h tmp-path1 &&
- test -d tmp-path1 &&
- test -f tmp-path1/file1
+ test_path_is_file tmp-path0 &&
+ test_path_is_dir_not_symlink tmp-path1 &&
+ test_path_is_file tmp-path1/file1
'
test_expect_success 'apply filter from working tree .gitattributes with --prefix' '