* [PATCH 0/2] Update tests to use semantic functions
@ 2026-09-04 20:35 Mark C. Chu-Carroll via B4 Relay
2026-09-04 20:35 ` [PATCH 1/2] Update shell " Mark C. Chu-Carroll via B4 Relay
2026-09-04 20:35 ` [PATCH 2/2] Second batch of shell test migrations Mark C. Chu-Carroll via B4 Relay
0 siblings, 2 replies; 5+ messages in thread
From: Mark C. Chu-Carroll via B4 Relay @ 2026-09-04 20:35 UTC (permalink / raw)
To: git; +Cc: Mark C. Chu-Carroll
Update tests to use semantic functions like "test_path_is_file"
instead of the older "test -f". All of the tests that make simple
usages are updated; tests that do more complicated things like
starting subshells are left unchanged.
Signed-off-by: Mark C. Chu-Carroll <markchucarroll@fastmail.com>
---
Mark C. Chu-Carroll (2):
Update shell tests to use semantic functions
Second batch of shell test migrations.
t/perf/p5302-pack-index.sh | 2 +-
t/t0007-git-var.sh | 2 +-
t/t0031-lockfile-pid.sh | 2 +-
t/t0081-find-pack.sh | 2 +-
t/t0200-gettext-basic.sh | 2 +-
t/t1007-hash-object.sh | 6 +++---
t/t1700-split-index.sh | 2 +-
t/t2005-checkout-index-symlinks.sh | 2 +-
t/t2030-unresolve-info.sh | 8 ++++----
t/t2201-add-update-typechange.sh | 2 +-
t/t3300-funny-names.sh | 2 +-
t/t3306-notes-prune.sh | 2 +-
t/t3311-notes-merge-fanout.sh | 2 +-
t/t3434-rebase-i18n.sh | 2 +-
t/t3902-quoted.sh | 2 +-
t/t4013-diff-various.sh | 2 +-
t/t4014-format-patch.sh | 6 +++---
t/t4016-diff-quote.sh | 2 +-
t/t4032-diff-inter-hunk-context.sh | 4 ++--
t/t4102-apply-rename.sh | 2 +-
t/t4131-apply-fake-ancestor.sh | 2 +-
t/t4132-apply-removal.sh | 4 ++--
t/t4252-am-options.sh | 2 +-
t/t5000-tar-tree.sh | 2 +-
t/t5100-mailinfo.sh | 6 +++---
t/t5300-pack-object.sh | 10 +++++-----
t/t5301-sliding-window.sh | 4 ++--
t/t5302-pack-index.sh | 8 ++++----
t/t5334-incremental-multi-pack-index.sh | 2 +-
t/t5402-post-merge-hook.sh | 2 +-
t/t5500-fetch-pack.sh | 2 +-
t/t5502-quickfetch.sh | 2 +-
t/t5510-fetch.sh | 8 ++++----
t/t5515-fetch-merge-logic.sh | 4 ++--
t/t5516-fetch-push.sh | 2 +-
t/t5526-fetch-submodules.sh | 8 ++++----
t/t5534-push-signed.sh | 6 +++---
t/t5550-http-fetch-dumb.sh | 2 +-
t/t5601-clone.sh | 16 ++++++++--------
t/t5604-clone-reference.sh | 2 +-
t/t5702-protocol-v2.sh | 4 ++--
t/t5710-promisor-remote-capability.sh | 2 +-
t/t6030-bisect-porcelain.sh | 2 +-
t/t6500-gc.sh | 2 +-
t/t7004-tag.sh | 4 ++--
t/t7011-skip-worktree-reading.sh | 2 +-
t/t7012-skip-worktree-writing.sh | 2 +-
t/t7102-reset.sh | 2 +-
t/t7104-reset-hard.sh | 2 +-
t/t7113-post-index-change-hook.sh | 12 ++++++------
t/t7201-co.sh | 6 +++---
t/t7400-submodule-basic.sh | 10 +++++-----
t/t7407-submodule-foreach.sh | 6 +++---
t/t7409-submodule-detached-work-tree.sh | 2 +-
t/t7412-submodule-absorbgitdirs.sh | 8 ++++----
t/t7450-bad-git-dotfiles.sh | 6 +++---
t/t7602-merge-octopus-many.sh | 2 +-
t/t7606-merge-custom.sh | 8 ++++----
t/t7610-mergetool.sh | 6 +++---
t/t9400-git-cvsserver-server.sh | 6 +++---
t/t9804-git-p4-label.sh | 8 ++++----
61 files changed, 126 insertions(+), 126 deletions(-)
---
base-commit: 2c3adbb2c475981e340c79fdc5e7f4f9b5d9054e
change-id: 20260904-file-tests-use-shell-functions-e0d6c545d56c
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] Update shell tests to use semantic functions
2026-09-04 20:35 [PATCH 0/2] Update tests to use semantic functions Mark C. Chu-Carroll via B4 Relay
@ 2026-09-04 20:35 ` Mark C. Chu-Carroll via B4 Relay
2026-09-05 2:17 ` Junio C Hamano
2026-09-07 12:10 ` Patrick Steinhardt
2026-09-04 20:35 ` [PATCH 2/2] Second batch of shell test migrations Mark C. Chu-Carroll via B4 Relay
1 sibling, 2 replies; 5+ messages in thread
From: Mark C. Chu-Carroll via B4 Relay @ 2026-09-04 20:35 UTC (permalink / raw)
To: git; +Cc: Mark C. Chu-Carroll
From: "Mark C. Chu-Carroll" <markchucarroll@fastmail.com>
This updates an initial bash of shell tests to replace uses
of "test -f" and "! test -f" with "test_path_is_file" and
"test_path_is_missing".
---
t/t0031-lockfile-pid.sh | 2 +-
t/t0200-gettext-basic.sh | 2 +-
t/t1007-hash-object.sh | 6 +++---
t/t2030-unresolve-info.sh | 8 ++++----
t/t2201-add-update-typechange.sh | 2 +-
t/t3300-funny-names.sh | 2 +-
t/t3306-notes-prune.sh | 2 +-
t/t3311-notes-merge-fanout.sh | 2 +-
t/t4014-format-patch.sh | 6 +++---
t/t4032-diff-inter-hunk-context.sh | 4 ++--
t/t4102-apply-rename.sh | 2 +-
t/t4131-apply-fake-ancestor.sh | 2 +-
t/t4132-apply-removal.sh | 4 ++--
t/t5300-pack-object.sh | 10 +++++-----
t/t5301-sliding-window.sh | 4 ++--
t/t5302-pack-index.sh | 8 ++++----
t/t5502-quickfetch.sh | 2 +-
t/t5510-fetch.sh | 8 ++++----
t/t5516-fetch-push.sh | 2 +-
t/t5534-push-signed.sh | 6 +++---
t/t5550-http-fetch-dumb.sh | 2 +-
t/t5604-clone-reference.sh | 2 +-
t/t6500-gc.sh | 2 +-
t/t7012-skip-worktree-writing.sh | 2 +-
t/t7102-reset.sh | 2 +-
t/t7104-reset-hard.sh | 2 +-
t/t7113-post-index-change-hook.sh | 12 ++++++------
t/t7201-co.sh | 6 +++---
t/t7400-submodule-basic.sh | 10 +++++-----
t/t7407-submodule-foreach.sh | 6 +++---
t/t7412-submodule-absorbgitdirs.sh | 8 ++++----
t/t7602-merge-octopus-many.sh | 2 +-
t/t9001-send-email.sh | 6 +++---
t/t9400-git-cvsserver-server.sh | 6 +++---
34 files changed, 76 insertions(+), 76 deletions(-)
diff --git a/t/t0031-lockfile-pid.sh b/t/t0031-lockfile-pid.sh
index e9e2f04049..9cca369e32 100755
--- a/t/t0031-lockfile-pid.sh
+++ b/t/t0031-lockfile-pid.sh
@@ -40,7 +40,7 @@ test_expect_success 'running process detected when PID is alive' '
echo content >file &&
# Get the correct PID for this platform
shell_pid=$$ &&
- if test_have_prereq MINGW && test -f /proc/$shell_pid/winpid
+ if test_have_prereq MINGW && test_path_is_file /proc/$shell_pid/winpid
then
# In Git for Windows, Bash uses MSYS2 PIDs but git.exe
# uses Windows PIDs. Use the Windows PID.
diff --git a/t/t0200-gettext-basic.sh b/t/t0200-gettext-basic.sh
index 8db26c1ada..8305291ce9 100755
--- a/t/t0200-gettext-basic.sh
+++ b/t/t0200-gettext-basic.sh
@@ -36,7 +36,7 @@ test_expect_success GETTEXT 'sanity: $TEXTDOMAINDIR exists without NO_GETTEXT=Ye
'
test_expect_success GETTEXT 'sanity: Icelandic locale was compiled' '
- test -f "$TEXTDOMAINDIR/is/LC_MESSAGES/git.mo"
+ test_path_is_file "$TEXTDOMAINDIR/is/LC_MESSAGES/git.mo"
'
# TODO: When we have more locales, generalize this to test them
diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
index 463b38f990..e6d1fe3e13 100755
--- a/t/t1007-hash-object.sh
+++ b/t/t1007-hash-object.sh
@@ -271,7 +271,7 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
'files over 4GB hash correctly via --stdin' '
- { test -f big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
+ { test_path_is_file big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
test_oid large5GB >expect &&
git hash-object --stdin <big >actual &&
test_cmp expect actual
@@ -279,7 +279,7 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
'files over 4GB hash correctly' '
- { test -f big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
+ { test_path_is_file big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
test_oid large5GB >expect &&
git hash-object -- big >actual &&
test_cmp expect actual
@@ -289,7 +289,7 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
# We ensure that cleaning doesn't mangle large files on 64-bit Windows.
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
'hash filtered files over 4GB correctly' '
- { test -f big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
+ { test_path_is_file big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
test_oid large5GB >expect &&
test_config filter.null-filter.clean "cat" &&
echo "big filter=null-filter" >.gitattributes &&
diff --git a/t/t2030-unresolve-info.sh b/t/t2030-unresolve-info.sh
index 9af24b1204..f4ff7591fc 100755
--- a/t/t2030-unresolve-info.sh
+++ b/t/t2030-unresolve-info.sh
@@ -170,7 +170,7 @@ test_expect_success 'rerere and rerere forget' '
git rerere &&
rerere_id=$(cd .git/rr-cache && echo */postimage) &&
rerere_id=${rerere_id%/postimage} &&
- test -f .git/rr-cache/$rerere_id/postimage &&
+ test_path_is_file .git/rr-cache/$rerere_id/postimage &&
git checkout -m fi/le &&
echo resurrect the conflict &&
test_grep "^=======" fi/le &&
@@ -182,7 +182,7 @@ test_expect_success 'rerere and rerere forget' '
check_resolve_undo kept fi/le initial:fi/le second:fi/le third:fi/le &&
test -z "$(git ls-files -u)" &&
git rerere forget fi/le &&
- ! test -f .git/rr-cache/$rerere_id/postimage &&
+ ! test_path_is_file .git/rr-cache/$rerere_id/postimage &&
tr "\0" "\n" <.git/MERGE_RR >actual &&
echo "$rerere_id fi/le" >expect &&
test_cmp expect actual
@@ -196,7 +196,7 @@ test_expect_success 'rerere and rerere forget (subdirectory)' '
(cd fi && git rerere) &&
rerere_id=$(cd .git/rr-cache && echo */postimage) &&
rerere_id=${rerere_id%/postimage} &&
- test -f .git/rr-cache/$rerere_id/postimage &&
+ test_path_is_file .git/rr-cache/$rerere_id/postimage &&
(cd fi && git checkout -m le) &&
echo resurrect the conflict &&
test_grep "^=======" fi/le &&
@@ -208,7 +208,7 @@ test_expect_success 'rerere and rerere forget (subdirectory)' '
check_resolve_undo kept fi/le initial:fi/le second:fi/le third:fi/le &&
test -z "$(git ls-files -u)" &&
(cd fi && git rerere forget le) &&
- ! test -f .git/rr-cache/$rerere_id/postimage &&
+ test_path_is_missing .git/rr-cache/$rerere_id/postimage &&
tr "\0" "\n" <.git/MERGE_RR >actual &&
echo "$rerere_id fi/le" >expect &&
test_cmp expect actual
diff --git a/t/t2201-add-update-typechange.sh b/t/t2201-add-update-typechange.sh
index 687be974d4..f46ddc0100 100755
--- a/t/t2201-add-update-typechange.sh
+++ b/t/t2201-add-update-typechange.sh
@@ -131,7 +131,7 @@ test_expect_success 'add -u' '
'
test_expect_success 'commit -a' '
- if test -f ".git/saved-index"
+ if test_path_is_file ".git/saved-index"
then
rm -f ".git/index" &&
mv ".git/saved-index" ".git/index"
diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index dd0586b007..d73049922a 100755
--- a/t/t3300-funny-names.sh
+++ b/t/t3300-funny-names.sh
@@ -15,7 +15,7 @@ HT=' '
test_have_prereq MINGW ||
echo 2>/dev/null > "Name with an${HT}HT"
-if ! test -f "Name with an${HT}HT"
+if test_path_is_missing "Name with an${HT}HT"
then
# since FAT/NTFS does not allow tabs in filenames, skip this test
skip_all='Your filesystem does not allow tabs in filenames'
diff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh
index 8f4102ff9e..40c1eac56b 100755
--- a/t/t3306-notes-prune.sh
+++ b/t/t3306-notes-prune.sh
@@ -24,7 +24,7 @@ test_expect_success 'setup: create a few commits with notes' '
git commit -m 3rd &&
third=$(git rev-parse HEAD) &&
COMMIT_FILE=$(echo $third | sed "s!^..!.git/objects/&/!") &&
- test -f $COMMIT_FILE &&
+ test_path_is_file $COMMIT_FILE &&
test-tool chmtime =+0 $COMMIT_FILE &&
git notes add -m "Note #3"
'
diff --git a/t/t3311-notes-merge-fanout.sh b/t/t3311-notes-merge-fanout.sh
index 5b675417e9..a90999d6b4 100755
--- a/t/t3311-notes-merge-fanout.sh
+++ b/t/t3311-notes-merge-fanout.sh
@@ -10,7 +10,7 @@ test_description='Test notes merging at various fanout levels'
verify_notes () {
notes_ref="$1"
commit="$2"
- if test -f "expect_notes_$notes_ref"
+ if test_path_is_file "expect_notes_$notes_ref"
then
git -c core.notesRef="refs/notes/$notes_ref" notes |
sort >"output_notes_$notes_ref" &&
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 4afcd85779..53257e7e0a 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -888,7 +888,7 @@ test_expect_success 'format-patch from a subdirectory (1)' '
false
;;
esac &&
- test -f "$filename"
+ test_path_is_file "$filename"
'
test_expect_success 'format-patch from a subdirectory (2)' '
@@ -907,7 +907,7 @@ test_expect_success 'format-patch from a subdirectory (2)' '
;;
esac &&
basename=$(expr "$filename" : ".*/\(.*\)") &&
- test -f "sub/$basename"
+ test_path_is_file "sub/$basename"
'
test_expect_success 'format-patch from a subdirectory (3)' '
@@ -919,7 +919,7 @@ test_expect_success 'format-patch from a subdirectory (3)' '
git format-patch -1 -o "$TRASH_DIRECTORY"
) &&
basename=$(expr "$filename" : ".*/\(.*\)") &&
- test -f "$basename"
+ test_path_is_file "$basename"
'
test_expect_success 'format-patch --in-reply-to' '
diff --git a/t/t4032-diff-inter-hunk-context.sh b/t/t4032-diff-inter-hunk-context.sh
index 7d443968e3..cc213c04a1 100755
--- a/t/t4032-diff-inter-hunk-context.sh
+++ b/t/t4032-diff-inter-hunk-context.sh
@@ -28,7 +28,7 @@ t() {
file=f$1
expected=expected.$file.$3.$hunks
- if ! test -f $file
+ if test_path_is_missing $file
then
f A $1 B >$file
git add $file
@@ -40,7 +40,7 @@ t() {
test $(git $cmd $file | grep '^@@ ' | wc -l) = $hunks
"
- if test -f $expected
+ if test_path_is_file $expected
then
test_expect_success "$label: check output" "
git $cmd $file | grep -v '^index ' >actual &&
diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh
index e42a31c917..6910289e88 100755
--- a/t/t4102-apply-rename.sh
+++ b/t/t4102-apply-rename.sh
@@ -33,7 +33,7 @@ test_expect_success apply \
'git apply --index --stat --summary --apply test-patch'
test_expect_success FILEMODE validate \
- 'test -f bar && ls -l bar | grep "^-..x......"'
+ 'test_path_is_file bar && ls -l bar | grep "^-..x......"'
test_expect_success 'apply reverse' \
'git apply -R --index --stat --summary --apply test-patch &&
diff --git a/t/t4131-apply-fake-ancestor.sh b/t/t4131-apply-fake-ancestor.sh
index b1361ce546..648f928f7a 100755
--- a/t/t4131-apply-fake-ancestor.sh
+++ b/t/t4131-apply-fake-ancestor.sh
@@ -33,7 +33,7 @@ test_expect_success 'apply --build-fake-ancestor in a subdirectory' '
(
cd sub &&
git apply --build-fake-ancestor 3.ancestor ../3.patch &&
- test -f 3.ancestor
+ test_path_is_file 3.ancestor
) &&
git apply --build-fake-ancestor 3.ancestor 3.patch &&
test_cmp sub/3.ancestor 3.ancestor
diff --git a/t/t4132-apply-removal.sh b/t/t4132-apply-removal.sh
index ab1628d27d..55fc9d1700 100755
--- a/t/t4132-apply-removal.sh
+++ b/t/t4132-apply-removal.sh
@@ -80,7 +80,7 @@ do
cat something >file &&
git add file &&
git apply --index $patch &&
- test -f file &&
+ test_path_is_file file &&
test_must_be_empty file
;;
remove*)
@@ -88,7 +88,7 @@ do
cat something >file &&
git add file &&
git apply --index $patch &&
- ! test -f file
+ test_path_is_missing file
;;
esac
'
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 9dabb3615a..7e244a76df 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -259,11 +259,11 @@ test_expect_success 'survive missing objects/pack directory' '
GOP=.git/objects/pack &&
rm -fr $GOP &&
git index-pack --stdin --keep=test <../test-3-${packname_3}.pack &&
- test -f $GOP/pack-${packname_3}.pack &&
+ test_path_is_file $GOP/pack-${packname_3}.pack &&
cmp $GOP/pack-${packname_3}.pack ../test-3-${packname_3}.pack &&
- test -f $GOP/pack-${packname_3}.idx &&
+ test_path_is_file $GOP/pack-${packname_3}.idx &&
cmp $GOP/pack-${packname_3}.idx ../test-3-${packname_3}.idx &&
- test -f $GOP/pack-${packname_3}.keep
+ test_path_is_file $GOP/pack-${packname_3}.keep
)
'
@@ -352,7 +352,7 @@ test_expect_success 'build pack index for an existing pack' '
rm -f test-4.keep &&
git index-pack --keep=why test-4.pack &&
cmp test-1-${packname_1}.idx test-4.idx &&
- test -f test-4.keep &&
+ test_path_is_file test-4.keep &&
:
'
@@ -592,7 +592,7 @@ test_expect_success 'setup: fake a SHA1 hash collision' '
cd corrupt &&
long_a=$(git hash-object -w ../a | sed -e "s!^..!&/!") &&
long_b=$(git hash-object -w ../b | sed -e "s!^..!&/!") &&
- test -f .git/objects/$long_b &&
+ test_path_is_file .git/objects/$long_b &&
cp -f .git/objects/$long_a \
.git/objects/$long_b
)
diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
index 3c3666b278..b6868229bf 100755
--- a/t/t5301-sliding-window.sh
+++ b/t/t5301-sliding-window.sh
@@ -22,7 +22,7 @@ test_expect_success 'setup' '
git repack -a -d &&
test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
pack1=$(ls .git/objects/pack/*.pack) &&
- test -f "$pack1"
+ test_path_is_file "$pack1"
'
test_expect_success 'verify-pack -v, defaults' '
@@ -48,7 +48,7 @@ test_expect_success 'repack -a -d, packedGit{WindowSize,Limit} == 1 page' '
git repack -a -d &&
test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
pack2=$(ls .git/objects/pack/*.pack) &&
- test -f "$pack2" &&
+ test_path_is_file "$pack2" &&
test "$pack1" \!= "$pack2"
'
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 735de1023e..3182ff2023 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -169,7 +169,7 @@ test_expect_success \
test_expect_success \
'[index v1] 3) corrupted delta happily returned wrong data' '
- test -f file_101_foo1 && ! cmp file_101 file_101_foo1
+ test_path_is_file file_101_foo1 && ! cmp file_101 file_101_foo1
'
test_expect_success \
@@ -180,7 +180,7 @@ test_expect_success \
test_expect_success \
'[index v1] 5) pack-objects happily reuses corrupted data' '
pack4=$(git pack-objects test-4 <obj-list) &&
- test -f "test-4-${pack4}.pack"
+ test_path_is_file "test-4-${pack4}.pack"
'
test_expect_success '[index v1] 6) newly created pack is BAD !' '
@@ -214,7 +214,7 @@ test_expect_success \
test_expect_success \
'[index v2] 3) corrupted delta happily returned wrong data' '
- test -f file_101_foo2 && ! cmp file_101 file_101_foo2
+ test_path_is_file file_101_foo2 && ! cmp file_101 file_101_foo2
'
test_expect_success \
@@ -251,7 +251,7 @@ test_expect_success 'running index-pack in the object store' '
cd .git/objects/pack &&
git index-pack pack-${pack1}.pack
) &&
- test -f .git/objects/pack/pack-${pack1}.idx
+ test_path_is_file .git/objects/pack/pack-${pack1}.idx
'
test_expect_success 'index-pack --strict warns upon missing tagger in tag' '
diff --git a/t/t5502-quickfetch.sh b/t/t5502-quickfetch.sh
index b160f8b7fb..62d2284752 100755
--- a/t/t5502-quickfetch.sh
+++ b/t/t5502-quickfetch.sh
@@ -63,7 +63,7 @@ test_expect_success 'copy commit and tree but not blob by hand' '
test $cnt -eq 6 &&
blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") &&
- test -f "cloned/.git/objects/$blob" &&
+ test_path_is_file "cloned/.git/objects/$blob" &&
rm -f "cloned/.git/objects/$blob" &&
cnt=$( (
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index a8d38d9176..c4b0770d0d 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -1009,21 +1009,21 @@ test_expect_success 'fetch into the current branch with --update-head-ok' '
test_expect_success 'fetch --dry-run does not touch FETCH_HEAD, but still prints what would be written' '
rm -f .git/FETCH_HEAD err &&
git fetch --dry-run . 2>err &&
- ! test -f .git/FETCH_HEAD &&
+ test_path_is_missing .git/FETCH_HEAD &&
test_grep FETCH_HEAD err
'
test_expect_success '--no-write-fetch-head does not touch FETCH_HEAD, and does not print what would be written' '
rm -f .git/FETCH_HEAD err &&
git fetch --no-write-fetch-head . 2>err &&
- ! test -f .git/FETCH_HEAD &&
+ test_path_is_missing .git/FETCH_HEAD &&
test_grep ! FETCH_HEAD err
'
test_expect_success '--write-fetch-head gets defeated by --dry-run' '
rm -f .git/FETCH_HEAD &&
git fetch --dry-run --write-fetch-head . &&
- ! test -f .git/FETCH_HEAD
+ test_path_is_missing .git/FETCH_HEAD
'
test_expect_success "should be able to fetch with duplicate refspecs" '
@@ -2026,7 +2026,7 @@ test_expect_success REFFILES "HEAD is updated even with conflicts" '
mkdir -p refs/remotes/origin &&
>refs/remotes/origin/branch.lock &&
test_must_fail git fetch origin &&
- test -f refs/remotes/origin/HEAD
+ test_path_is_file refs/remotes/origin/HEAD
)
'
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index f3b3efc47f..8efb6b185d 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -688,7 +688,7 @@ test_expect_success 'push preserves up-to-date packed refs' '
(
cd child &&
git push &&
- ! test -f .git/refs/remotes/origin/main
+ test_path_is_missing .git/refs/remotes/origin/main
)
'
diff --git a/t/t5534-push-signed.sh b/t/t5534-push-signed.sh
index 21f0262cbd..d60f5fe69c 100755
--- a/t/t5534-push-signed.sh
+++ b/t/t5534-push-signed.sh
@@ -46,7 +46,7 @@ test_expect_success 'unsigned push does not send push certificate' '
EOF
git push dst noop ff +noff &&
- ! test -f dst/push-cert
+ test_path_is_missing dst/push-cert
'
test_expect_success 'talking with a receiver without push certificate support' '
@@ -62,7 +62,7 @@ test_expect_success 'talking with a receiver without push certificate support' '
EOF
git push dst noop ff +noff &&
- ! test -f dst/push-cert
+ test_path_is_missing dst/push-cert
'
test_expect_success 'push --signed fails with a receiver without push certificate support' '
@@ -86,7 +86,7 @@ test_expect_success GPG 'no certificate for a signed push with no update' '
fi
EOF
git push dst noop &&
- ! test -f dst/push-cert
+ test_path_is_missing dst/push-cert
'
test_expect_success GPG 'signed push sends push certificate' '
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index b5758f1c9c..449d75b7c5 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -334,7 +334,7 @@ test_expect_success 'http-fetch --packfile permits unlink while indexing' '
ls objects/pack/pack-*.pack) &&
tmpfile="packfileclient-unlink/.git/objects/pack/pack-$ARBITRARY.pack.temp" &&
write_script git-unlink-index-pack <<-\EOF &&
- test -f "$GIT_TEST_PACK_TEMP" || exit 1
+ test_path_is_file "$GIT_TEST_PACK_TEMP" || exit 1
rm "$GIT_TEST_PACK_TEMP" || exit 1
exec git index-pack "$@"
EOF
diff --git a/t/t5604-clone-reference.sh b/t/t5604-clone-reference.sh
index 39a0c318df..14e93c4352 100755
--- a/t/t5604-clone-reference.sh
+++ b/t/t5604-clone-reference.sh
@@ -220,7 +220,7 @@ test_expect_success 'clone, dissociate from alternates' '
git clone --reference=A A B &&
test_line_count = 1 B/.git/objects/info/alternates &&
git clone --local --dissociate B C &&
- ! test -f C/.git/objects/info/alternates &&
+ test_path_is_missing C/.git/objects/info/alternates &&
( cd C && git fsck )
'
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index a7142ab815..1ae9192cd2 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -415,7 +415,7 @@ test_expect_success 'background auto gc respects lock for all operations' '
# shell pid so that it looks valid.
hostname=$(hostname || echo unknown) &&
shell_pid=$$ &&
- if test_have_prereq MINGW && test -f /proc/$shell_pid/winpid
+ if test_have_prereq MINGW && test_path_is_file /proc/$shell_pid/winpid
then
# In Git for Windows, Bash (actually, the MSYS2 runtime) has a
# different idea of PIDs than git.exe (actually Windows). Use
diff --git a/t/t7012-skip-worktree-writing.sh b/t/t7012-skip-worktree-writing.sh
index 526cc4ec83..4073d87753 100755
--- a/t/t7012-skip-worktree-writing.sh
+++ b/t/t7012-skip-worktree-writing.sh
@@ -54,7 +54,7 @@ test_expect_success 'read-tree removes worktree, dirty case' '
'
setup_absent() {
- test -f 1 && rm 1
+ test_path_is_file 1 && rm 1
git update-index --remove 1 &&
git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 &&
git update-index --skip-worktree 1
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 298272cb13..70fac59847 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -558,7 +558,7 @@ test_expect_success 'disambiguation (1)' '
git reset secondfile &&
test_must_fail git diff --quiet -- secondfile &&
test -z "$(git diff --cached --name-only)" &&
- test -f secondfile &&
+ test_path_is_file secondfile &&
test_must_be_empty secondfile
'
diff --git a/t/t7104-reset-hard.sh b/t/t7104-reset-hard.sh
index c23d6e3f52..acf145e69b 100755
--- a/t/t7104-reset-hard.sh
+++ b/t/t7104-reset-hard.sh
@@ -29,7 +29,7 @@ test_expect_success 'reset --hard should restore unmerged ones' '
git reset --hard &&
git ls-files --error-unmatch before/1 before/2 hello later/3 &&
- test -f hello
+ test_path_is_file hello
'
diff --git a/t/t7113-post-index-change-hook.sh b/t/t7113-post-index-change-hook.sh
index c10d94fe3d..0d97ab5fd3 100755
--- a/t/t7113-post-index-change-hook.sh
+++ b/t/t7113-post-index-change-hook.sh
@@ -25,11 +25,11 @@ test_expect_success 'test status, add, commit, others trigger hook without flags
echo "Invalid combination of flags passed to hook; updated_skipworktree is set." >testfailure
exit 1
fi
- if test -f ".git/index.lock"; then
+ if test_path_is_file ".git/index.lock"; then
echo ".git/index.lock exists" >testfailure
exit 3
fi
- if ! test -f ".git/index"; then
+ if test_path_is_missing ".git/index"; then
echo ".git/index does not exist" >testfailure
exit 3
fi
@@ -71,11 +71,11 @@ test_expect_success 'test checkout and reset trigger the hook' '
exit 2
fi
if test "$1" -eq 1; then
- if test -f ".git/index.lock"; then
+ if test_path_is_file ".git/index.lock"; then
echo "updated_workdir set but .git/index.lock exists" >testfailure
exit 3
fi
- if ! test -f ".git/index"; then
+ if test_path_is_missing ".git/index"; then
echo "updated_workdir set but .git/index does not exist" >testfailure
exit 3
fi
@@ -114,11 +114,11 @@ test_expect_success 'test reset --mixed and update-index triggers the hook' '
exit 2
fi
if test "$2" -eq 1; then
- if test -f ".git/index.lock"; then
+ if test_path_is_file ".git/index.lock"; then
echo "updated_skipworktree set but .git/index.lock exists" >testfailure
exit 3
fi
- if ! test -f ".git/index"; then
+ if test_path_is_missing ".git/index"; then
echo "updated_skipworktree set but .git/index does not exist" >testfailure
exit 3
fi
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 0ddd1ad7aa..835dd5eb4d 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -135,7 +135,7 @@ test_expect_success 'checkout -m with dirty tree, renamed' '
git checkout -m renamer &&
fill 1 3 4 5 7 8 >expect &&
test_cmp expect uno &&
- ! test -f one &&
+ test_path_is_missing one &&
git diff --cached >current &&
test_must_be_empty current
'
@@ -422,7 +422,7 @@ test_expect_success 'switch branches while in subdirectory' '
mkdir subs &&
git -C subs checkout side &&
- ! test -f subs/one &&
+ test_path_is_missing subs/one &&
rm -fr subs
'
@@ -437,7 +437,7 @@ test_expect_success 'checkout specific path while in subdirectory' '
git checkout main &&
mkdir -p subs &&
git -C subs checkout side -- bero &&
- test -f subs/bero
+ test_path_is_file subs/bero
'
test_expect_success 'checkout w/--track sets up tracking' '
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index eefdecb0bd..de291a03b0 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -1147,7 +1147,7 @@ test_expect_success 'submodule deinit should remove the whole submodule section
git submodule deinit init &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
test -n "$(git config --get-regexp "submodule\.example2\.")" &&
- test -f example2/.git &&
+ test_path_is_file example2/.git &&
rmdir init
'
@@ -1167,7 +1167,7 @@ test_expect_success 'submodule deinit from subdirectory' '
test_grep "\\.\\./init" output &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
test -n "$(git config --get-regexp "submodule\.example2\.")" &&
- test -f example2/.git &&
+ test_path_is_file example2/.git &&
rmdir init
'
@@ -1213,7 +1213,7 @@ test_expect_success 'submodule deinit fails when the submodule contains modifica
echo X >>init/s &&
test_must_fail git submodule deinit init &&
test -n "$(git config --get-regexp "submodule\.example\.")" &&
- test -f example2/.git &&
+ test_path_is_file example2/.git &&
git submodule deinit -f init >actual &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
test_grep "Cleared directory .init" actual &&
@@ -1225,7 +1225,7 @@ test_expect_success 'submodule deinit fails when the submodule contains untracke
echo X >>init/untracked &&
test_must_fail git submodule deinit init &&
test -n "$(git config --get-regexp "submodule\.example\.")" &&
- test -f example2/.git &&
+ test_path_is_file example2/.git &&
git submodule deinit -f init >actual &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
test_grep "Cleared directory .init" actual &&
@@ -1240,7 +1240,7 @@ test_expect_success 'submodule deinit fails when the submodule HEAD does not mat
) &&
test_must_fail git submodule deinit init &&
test -n "$(git config --get-regexp "submodule\.example\.")" &&
- test -f example2/.git &&
+ test_path_is_file example2/.git &&
git submodule deinit -f init >actual &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
test_grep "Cleared directory .init" actual &&
diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh
index 77b6d0040e..fcdf298055 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -368,9 +368,9 @@ test_expect_success 'test "update --recursive" with a flag with spaces' '
git rev-parse --resolve-git-dir nested1/.git &&
git rev-parse --resolve-git-dir nested1/nested2/.git &&
git rev-parse --resolve-git-dir nested1/nested2/nested3/.git &&
- test -f .git/modules/nested1/objects/info/alternates &&
- test -f .git/modules/nested1/modules/nested2/objects/info/alternates &&
- test -f .git/modules/nested1/modules/nested2/modules/nested3/objects/info/alternates
+ test_path_is_file .git/modules/nested1/objects/info/alternates &&
+ test_path_is_file .git/modules/nested1/modules/nested2/objects/info/alternates &&
+ test_path_is_file .git/modules/nested1/modules/nested2/modules/nested3/objects/info/alternates
)
'
diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh
index 0490499573..70df34ac28 100755
--- a/t/t7412-submodule-absorbgitdirs.sh
+++ b/t/t7412-submodule-absorbgitdirs.sh
@@ -34,7 +34,7 @@ test_expect_success 'absorb the git dir' '
git submodule absorbgitdirs 2>actual &&
test_cmp expect actual &&
git fsck &&
- test -f sub1/.git &&
+ test_path_is_file sub1/.git &&
test -d .git/modules/sub1 &&
git status >actual.1 &&
git -C sub1 rev-parse HEAD >actual.2 &&
@@ -72,7 +72,7 @@ test_expect_success 'absorb the git dir in a nested submodule' '
EOF
git submodule absorbgitdirs 2>actual &&
test_cmp expect actual &&
- test -f sub1/nested/.git &&
+ test_path_is_file sub1/nested/.git &&
test -d .git/modules/sub1/modules/nested &&
git status >actual.1 &&
git -C sub1/nested rev-parse HEAD >actual.2 &&
@@ -109,8 +109,8 @@ test_expect_success 'absorb the git dir in a nested submodule' '
EOF
git submodule absorbgitdirs 2>actual &&
test_cmp expect actual &&
- test -f sub1/.git &&
- test -f sub1/nested/.git &&
+ test_path_is_file sub1/.git &&
+ test_path_is_file sub1/nested/.git &&
test -d .git/modules/sub1/modules/nested &&
git status >actual.1 &&
git -C sub1/nested rev-parse HEAD >actual.2 &&
diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh
index 42f675b739..20bc57ef30 100755
--- a/t/t7602-merge-octopus-many.sh
+++ b/t/t7602-merge-octopus-many.sh
@@ -44,7 +44,7 @@ test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
i=1 &&
while test $i -le 30
do
- test -f c$i.c &&
+ test_path_is_file c$i.c &&
i=$(expr $i + 1) || return 1
done
'
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index d1393ef197..78db65189e 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -26,7 +26,7 @@ test_expect_success $PREREQ 'Setup helper tool' '
write_script fake.sendmail <<-\EOF &&
shift
output=1
- while test -f commandline$output
+ while test_path_is_file commandline$output
do
output=$(($output+1))
done
@@ -66,7 +66,7 @@ test_no_confirm () {
# Exit immediately to prevent hang if a no-confirm test fails
check_no_confirm () {
- if ! test -f no_confirm_okay
+ if test_path_is_missing no_confirm_okay
then
say 'confirm test failed; skipping remaining tests to prevent hanging'
PREREQ="$PREREQ,CHECK_NO_CONFIRM"
@@ -2722,7 +2722,7 @@ test_expect_success $PREREQ 'invoke hook' '
false
;;
esac &&
- test -f 0001-add-main.patch &&
+ test_path_is_file 0001-add-main.patch &&
grep "add main" "$1"
EOF
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index b2379e4671..c9f9fb6975 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -286,7 +286,7 @@ test_expect_success 'gitcvs.dbname' '
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
test_cmp cvswork cvswork2 &&
- test -f "$SERVERDIR/gitcvs.ext.main.sqlite" &&
+ test_path_is_file "$SERVERDIR/gitcvs.ext.main.sqlite" &&
cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs.ext.main.sqlite"
'
@@ -297,8 +297,8 @@ test_expect_success 'gitcvs.ext.dbname' '
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
test_cmp cvswork cvswork2 &&
- test -f "$SERVERDIR/gitcvs1.ext.main.sqlite" &&
- test ! -f "$SERVERDIR/gitcvs2.ext.main.sqlite" &&
+ test_path_is_file "$SERVERDIR/gitcvs1.ext.main.sqlite" &&
+ test_path_is_missing "$SERVERDIR/gitcvs2.ext.main.sqlite" &&
cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs1.ext.main.sqlite"
'
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Second batch of shell test migrations.
2026-09-04 20:35 [PATCH 0/2] Update tests to use semantic functions Mark C. Chu-Carroll via B4 Relay
2026-09-04 20:35 ` [PATCH 1/2] Update shell " Mark C. Chu-Carroll via B4 Relay
@ 2026-09-04 20:35 ` Mark C. Chu-Carroll via B4 Relay
1 sibling, 0 replies; 5+ messages in thread
From: Mark C. Chu-Carroll via B4 Relay @ 2026-09-04 20:35 UTC (permalink / raw)
To: git; +Cc: Mark C. Chu-Carroll
From: "Mark C. Chu-Carroll" <markchucarroll@fastmail.com>
---
t/perf/p5302-pack-index.sh | 2 +-
t/t0007-git-var.sh | 2 +-
t/t0081-find-pack.sh | 2 +-
t/t1700-split-index.sh | 2 +-
t/t2005-checkout-index-symlinks.sh | 2 +-
t/t3434-rebase-i18n.sh | 2 +-
t/t3902-quoted.sh | 2 +-
t/t4013-diff-various.sh | 2 +-
t/t4016-diff-quote.sh | 2 +-
t/t4252-am-options.sh | 2 +-
t/t5000-tar-tree.sh | 2 +-
t/t5100-mailinfo.sh | 6 +++---
t/t5334-incremental-multi-pack-index.sh | 2 +-
t/t5402-post-merge-hook.sh | 2 +-
t/t5500-fetch-pack.sh | 2 +-
t/t5515-fetch-merge-logic.sh | 4 ++--
t/t5526-fetch-submodules.sh | 8 ++++----
t/t5601-clone.sh | 16 ++++++++--------
t/t5702-protocol-v2.sh | 4 ++--
t/t5710-promisor-remote-capability.sh | 2 +-
t/t6030-bisect-porcelain.sh | 2 +-
t/t7004-tag.sh | 4 ++--
t/t7011-skip-worktree-reading.sh | 2 +-
t/t7409-submodule-detached-work-tree.sh | 2 +-
t/t7450-bad-git-dotfiles.sh | 6 +++---
t/t7606-merge-custom.sh | 8 ++++----
t/t7610-mergetool.sh | 6 +++---
t/t9001-send-email.sh | 6 +++---
t/t9804-git-p4-label.sh | 8 ++++----
29 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/t/perf/p5302-pack-index.sh b/t/perf/p5302-pack-index.sh
index 14c601bbf8..d3a3ea360f 100755
--- a/t/perf/p5302-pack-index.sh
+++ b/t/perf/p5302-pack-index.sh
@@ -9,7 +9,7 @@ test_perf_large_repo
test_expect_success 'repack' '
git repack -ad &&
PACK=$(ls .git/objects/pack/*.pack | head -n1) &&
- test -f "$PACK" &&
+ test_path_is_file "$PACK" &&
export PACK
'
diff --git a/t/t0007-git-var.sh b/t/t0007-git-var.sh
index 2b60317758..6a8fe69c08 100755
--- a/t/t0007-git-var.sh
+++ b/t/t0007-git-var.sh
@@ -156,7 +156,7 @@ test_expect_success POSIXPERM 'GIT_SHELL_PATH points to a valid executable' '
test_expect_success MINGW 'GIT_SHELL_PATH points to a suitable shell' '
shellpath=$(git var GIT_SHELL_PATH) &&
case "$shellpath" in
- [A-Z]:/*/sh.exe) test -f "$shellpath";;
+ [A-Z]:/*/sh.exe) test_path_is_file "$shellpath";;
*) return 1;;
esac
'
diff --git a/t/t0081-find-pack.sh b/t/t0081-find-pack.sh
index ff9d56fbf1..7d5082c487 100755
--- a/t/t0081-find-pack.sh
+++ b/t/t0081-find-pack.sh
@@ -32,7 +32,7 @@ test_expect_success 'repack everything into a single packfile' '
".git/objects/pack/pack-"*".pack") true ;;
*) false ;;
esac &&
- test -f "$head_commit_pack" &&
+ test_path_is_file "$head_commit_pack" &&
# Everything is in the same pack
test "$head_commit_pack" = "$head_tree_pack" &&
diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh
index 887e72a5fa..8e973838d0 100755
--- a/t/t1700-split-index.sh
+++ b/t/t1700-split-index.sh
@@ -460,7 +460,7 @@ test_expect_success POSIXPERM,SANITY 'graceful handling when splitting index is
cd ro &&
test_commit initial &&
git update-index --split-index &&
- test -f .git/sharedindex.*
+ test_path_is_file .git/sharedindex.*
) &&
cp ro/.git/index new-index &&
test_when_finished "chmod u+w ro/.git" &&
diff --git a/t/t2005-checkout-index-symlinks.sh b/t/t2005-checkout-index-symlinks.sh
index 91b08e0371..3ec071125f 100755
--- a/t/t2005-checkout-index-symlinks.sh
+++ b/t/t2005-checkout-index-symlinks.sh
@@ -19,7 +19,7 @@ echo "120000 $l symlink" | git update-index --index-info'
test_expect_success \
'the checked-out symlink must be a file' '
git checkout-index symlink &&
-test -f symlink'
+test_path_is_file symlink'
test_expect_success 'the file must be the blob we added during the setup' '
echo "$l" >expect &&
diff --git a/t/t3434-rebase-i18n.sh b/t/t3434-rebase-i18n.sh
index 0f93a239f8..8b217380f0 100755
--- a/t/t3434-rebase-i18n.sh
+++ b/t/t3434-rebase-i18n.sh
@@ -75,7 +75,7 @@ test_rebase_continue_update_encode () {
git commit -F "$TEST_DIRECTORY/t3434/$msgfile" &&
git config i18n.commitencoding $new &&
test_must_fail git rebase -m main &&
- test -f .git/rebase-merge/message &&
+ test_path_is_file .git/rebase-merge/message &&
git stripspace -s <.git/rebase-merge/message >two.t &&
git add two.t &&
git rebase --continue &&
diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh
index 8660ec5cb0..ee0bfb6432 100755
--- a/t/t3902-quoted.sh
+++ b/t/t3902-quoted.sh
@@ -14,7 +14,7 @@ DQ='"'
test_have_prereq MINGW ||
echo foo 2>/dev/null > "Name and an${HT}HT"
-if ! test -f "Name and an${HT}HT"
+if test_path_is_missing "Name and an${HT}HT"
then
# FAT/NTFS does not allow tabs in filenames
skip_all='Your filesystem does not allow tabs in filenames'
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index b7a382c881..e3a1eb89c5 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -235,7 +235,7 @@ do
-e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
echo "\$"
} >"$actual" &&
- if test -f "$expect"
+ if test_path_is_file "$expect"
then
process_diffs "$actual" >actual &&
process_diffs "$expect" >expect &&
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index 876271d682..1226da6703 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -14,7 +14,7 @@ P2='pathname with SP'
P3='pathname
with LF'
test_have_prereq !MINGW &&
-echo 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
+echo 2>/dev/null >"$P1" && test_path_is_file "$P1" && rm -f "$P1" || {
skip_all='Your filesystem does not allow tabs in filenames'
test_done
}
diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh
index c36c7e9017..617b850f55 100755
--- a/t/t4252-am-options.sh
+++ b/t/t4252-am-options.sh
@@ -64,7 +64,7 @@ test_expect_success 'apply to a funny path' '
rm -fr .git/rebase-apply &&
git reset --hard initial &&
git am --directory="$with_sq" "$tm"/am-test-5-2 &&
- test -f "$with_sq/file-5"
+ test_path_is_file "$with_sq/file-5"
'
test_expect_success 'am --reject' '
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 3ad600c793..c99f90a212 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -34,7 +34,7 @@ test_lazy_prereq TAR_NEEDS_PAX_FALLBACK '
mkdir pax &&
cd pax &&
"$TAR" xf "$TEST_DIRECTORY"/t5000/pax.tar &&
- test -f PaxHeaders.1791/file
+ test_path_is_file PaxHeaders.1791/file
)
'
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index e01078abe7..68d6c23175 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -34,15 +34,15 @@ do
test_expect_success $prereq "mailinfo $mail" '
check_mailinfo "$mail" "" &&
- if test -f "$DATA/msg$mail--scissors"
+ if test_path_is_file "$DATA/msg$mail--scissors"
then
check_mailinfo "$mail" --scissors
fi &&
- if test -f "$DATA/msg$mail--no-inbody-headers"
+ if test_path_is_file "$DATA/msg$mail--no-inbody-headers"
then
check_mailinfo "$mail" --no-inbody-headers
fi &&
- if test -f "$DATA/msg$mail--message-id"
+ if test_path_is_file "$DATA/msg$mail--message-id"
then
check_mailinfo "$mail" --message-id
fi
diff --git a/t/t5334-incremental-multi-pack-index.sh b/t/t5334-incremental-multi-pack-index.sh
index f0b82b5f65..d9bad96f78 100755
--- a/t/t5334-incremental-multi-pack-index.sh
+++ b/t/t5334-incremental-multi-pack-index.sh
@@ -47,7 +47,7 @@ compare_results_with_midx 'non-incremental MIDX conversion'
write_midx_layer () {
n=1
- if test -f $midx_chain
+ if test_path_is_file $midx_chain
then
n="$(($(wc -l <$midx_chain) + 1))"
fi
diff --git a/t/t5402-post-merge-hook.sh b/t/t5402-post-merge-hook.sh
index c77aa56421..e43b19ac43 100755
--- a/t/t5402-post-merge-hook.sh
+++ b/t/t5402-post-merge-hook.sh
@@ -37,7 +37,7 @@ test_expect_success 'setup clone hooks' '
test_expect_success 'post-merge does not run for up-to-date ' '
GIT_DIR=clone1/.git git merge $commit0 &&
- ! test -f clone1/.git/post-merge.args
+ test_path_is_missing clone1/.git/post-merge.args
'
test_expect_success 'post-merge runs as expected ' '
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 6c1edf2117..5916e43565 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -317,7 +317,7 @@ test_expect_success 'turn shallow to complete repository' '
cd shallow &&
GIT_TRACE2_EVENT="$(pwd)/trace2_event" \
git fetch --unshallow &&
- ! test -f .git/shallow &&
+ test_path_is_missing .git/shallow &&
git fsck --full &&
test_grep \"fetch-info\".*\"shallows\":2 trace2_event &&
test_grep \"fetch-info\".*\"depth\":2147483647 trace2_event
diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index 8ac04d742c..a7d57b0e07 100755
--- a/t/t5515-fetch-merge-logic.sh
+++ b/t/t5515-fetch-merge-logic.sh
@@ -208,7 +208,7 @@ do
cat .git/FETCH_HEAD
} >"$actual_f" &&
git show-ref >"$actual_r" &&
- if test -f "expect_f"
+ if test_path_is_file "expect_f"
then
test_cmp "expect_f" "$actual_f" &&
rm -f "$actual_f"
@@ -217,7 +217,7 @@ do
cp "$actual_f" "$expect_f"
false
fi &&
- if test -f "expect_r"
+ if test_path_is_file "expect_r"
then
test_cmp "expect_r" "$actual_r" &&
rm -f "$actual_r"
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 7b3b7359da..a5b2fc8767 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -106,19 +106,19 @@ add_superproject_commits () {
verify_fetch_result () {
ACTUAL_ERR=$1 &&
rm -f expect.err.combined &&
- if test -f expect.err.super
+ if test_path_is_file expect.err.super
then
cat expect.err.super >>expect.err.combined
fi &&
- if test -f expect.err.sub
+ if test_path_is_file expect.err.sub
then
cat expect.err.sub >>expect.err.combined
fi &&
- if test -f expect.err.deep
+ if test_path_is_file expect.err.deep
then
cat expect.err.deep >>expect.err.combined
fi &&
- if test -f expect.err.sub2
+ if test_path_is_file expect.err.sub2
then
cat expect.err.sub2 >>expect.err.combined
fi &&
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index b6167582a1..8387bca417 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -57,7 +57,7 @@ test_expect_success 'clone does not keep pack' '
rm -fr dst &&
git clone -n "file://$(pwd)/src" dst &&
- ! test -f dst/file &&
+ test_path_is_missing dst/file &&
! (echo dst/.git/objects/pack/pack-* | grep "\.keep")
'
@@ -66,15 +66,15 @@ test_expect_success 'clone checks out files' '
rm -fr dst &&
git clone src dst &&
- test -f dst/file
+ test_path_is_file dst/file
'
test_expect_success 'clone respects GIT_WORK_TREE' '
GIT_WORK_TREE=worktree git clone src bare &&
- test -f bare/config &&
- test -f worktree/file
+ test_path_is_file bare/config &&
+ test_path_is_file worktree/file
'
@@ -102,22 +102,22 @@ test_expect_success 'clone from hooks' '
test_expect_success 'clone creates intermediate directories' '
git clone src long/path/to/dst &&
- test -f long/path/to/dst/file
+ test_path_is_file long/path/to/dst/file
'
test_expect_success 'clone creates intermediate directories for bare repo' '
git clone --bare src long/path/to/bare/dst &&
- test -f long/path/to/bare/dst/config
+ test_path_is_file long/path/to/bare/dst/config
'
test_expect_success 'clone --mirror' '
git clone --mirror src mirror &&
- test -f mirror/HEAD &&
- test ! -f mirror/file &&
+ test_path_is_file mirror/HEAD &&
+ test_path_is_missing mirror/file &&
FETCH="$(cd mirror && git config remote.origin.fetch)" &&
test "+refs/*:refs/*" = "$FETCH" &&
MIRROR="$(cd mirror && git config --bool remote.origin.mirror)" &&
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 0f05286de8..68fa8ebcf5 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -1261,8 +1261,8 @@ test_expect_success 'part of packfile response provided as URI' '
fi
fi || return 1
done &&
- test -f hfound &&
- test -f h2found &&
+ test_path_is_file hfound &&
+ test_path_is_file h2found &&
# Ensure that there are exactly 3 packfiles with associated .idx
ls http_child/.git/objects/pack/*.pack \
diff --git a/t/t5710-promisor-remote-capability.sh b/t/t5710-promisor-remote-capability.sh
index 549acff23f..fa2455cf31 100755
--- a/t/t5710-promisor-remote-capability.sh
+++ b/t/t5710-promisor-remote-capability.sh
@@ -41,7 +41,7 @@ check_missing_objects () {
then
test "$3" = "$(cat missing.txt)"
else
- test -f "$3" &&
+ test_path_is_file "$3" &&
sort <"$3" >expected_sorted &&
sort <missing.txt >actual_sorted &&
test_cmp expected_sorted actual_sorted
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index a7588222a8..c44daa7856 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -851,7 +851,7 @@ test_expect_success 'optimized merge base checks' '
test_grep "merge base must be tested" my_bisect_log.txt &&
test_grep "$HASH4" my_bisect_log.txt &&
git bisect good > my_bisect_log2.txt &&
- test -f ".git/BISECT_ANCESTORS_OK" &&
+ test_path_is_file ".git/BISECT_ANCESTORS_OK" &&
test "$HASH6" = $(git rev-parse --verify HEAD) &&
git bisect bad &&
git bisect good "$A_HASH" > my_bisect_log4.txt &&
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 8c795d7218..09a9559c74 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -538,7 +538,7 @@ test_expect_success 'creating an annotated tag with -F - should succeed' '
'
test_expect_success 'trying to create a tag with a non-existing -F file should fail' '
- ! test -f nonexistingfile &&
+ test_path_is_missing nonexistingfile &&
! tag_exists notag &&
test_must_fail git tag -F nonexistingfile notag &&
! tag_exists notag
@@ -1099,7 +1099,7 @@ test_expect_success GPG 'git tag --no-sign configured tag.gpgsign skip GPG sign'
'
test_expect_success GPG 'trying to create a signed tag with non-existing -F file should fail' '
- ! test -f nonexistingfile &&
+ test_path_is_missing nonexistingfile &&
! tag_exists nosigtag &&
test_must_fail git tag -s -F nonexistingfile nosigtag &&
! tag_exists nosigtag
diff --git a/t/t7011-skip-worktree-reading.sh b/t/t7011-skip-worktree-reading.sh
index 1ff2714cb4..4301960015 100755
--- a/t/t7011-skip-worktree-reading.sh
+++ b/t/t7011-skip-worktree-reading.sh
@@ -24,7 +24,7 @@ H sub/2
EOF
setup_absent() {
- test -f 1 && rm 1
+ test_path_is_file 1 && rm 1
git update-index --remove 1 &&
git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 &&
git update-index --skip-worktree 1
diff --git a/t/t7409-submodule-detached-work-tree.sh b/t/t7409-submodule-detached-work-tree.sh
index 374ed481e9..2b295bed6e 100755
--- a/t/t7409-submodule-detached-work-tree.sh
+++ b/t/t7409-submodule-detached-work-tree.sh
@@ -84,7 +84,7 @@ test_expect_success 'submodule on detached working pointed by core.worktree' '
git config core.worktree .. &&
git pull &&
git submodule update --init &&
- test -f .vim/bundle/dupe/shoot.t
+ test_path_is_file .vim/bundle/dupe/shoot.t
)
'
diff --git a/t/t7450-bad-git-dotfiles.sh b/t/t7450-bad-git-dotfiles.sh
index 72c7f6f73b..f8a7b262f2 100755
--- a/t/t7450-bad-git-dotfiles.sh
+++ b/t/t7450-bad-git-dotfiles.sh
@@ -320,7 +320,7 @@ test_expect_success WINDOWS 'prevent git~1 squatting on Windows' '
# git~2 is an 8.3 short name, present only when 8.3 name
# generation is enabled. The "directory not empty" check
# above is the primary assertion.
- if test -f squatting-clone/d/a/git~2
+ if test_path_is_file squatting-clone/d/a/git~2
then
test_grep ! gitdir squatting-clone/d/a/git~2
fi
@@ -409,8 +409,8 @@ test_expect_success SYMLINKS,!WINDOWS,!MINGW 'submodule must not checkout into d
git -C repo commit -m submodule &&
git -c protocol.file.allow=always clone --recurse-submodules repo bad-clone &&
- ! test -f "$PWD/bad-clone/sub/foo" &&
- test -f $(printf "bad-clone/sub\r/post-checkout")
+ test_path_is_missing "$PWD/bad-clone/sub/foo" &&
+ test_path_is_file $(printf "bad-clone/sub\r/post-checkout")
'
test_done
diff --git a/t/t7606-merge-custom.sh b/t/t7606-merge-custom.sh
index 0ae2f59b1d..67b01649e0 100755
--- a/t/t7606-merge-custom.sh
+++ b/t/t7606-merge-custom.sh
@@ -59,9 +59,9 @@ test_expect_success 'merge c2 with a custom strategy' '
test_cmp head.old first-parent &&
test_cmp second-parent.expected second-parent &&
test_cmp tree.expected tree &&
- test -f c0.c &&
+ test_path_is_file c0.c &&
test_grep c1c1 c1.c &&
- test -f c2.c
+ test_path_is_file c2.c
'
test_expect_success 'trivial merge with custom strategy' '
@@ -85,9 +85,9 @@ test_expect_success 'trivial merge with custom strategy' '
test_cmp head.old first-parent &&
test_cmp second-parent.expected second-parent &&
test_cmp tree.expected tree &&
- test -f c0.c &&
+ test_path_is_file c0.c &&
! test -e c1.c &&
- test -f c3.c
+ test_path_is_file c3.c
'
test_done
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 0128b14452..2cc3ea61c1 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -382,15 +382,15 @@ test_expect_success 'mergetool delete/delete conflict' '
git checkout -b test$test_count move-to-c &&
test_must_fail git merge move-to-b &&
echo d | git mergetool a/a/file.txt &&
- ! test -f a/a/file.txt &&
+ test_path_is_missing a/a/file.txt &&
git reset --hard &&
test_must_fail git merge move-to-b &&
echo m | git mergetool a/a/file.txt &&
- test -f b/b/file.txt &&
+ test_path_is_file b/b/file.txt &&
git reset --hard &&
test_must_fail git merge move-to-b &&
! echo a | git mergetool a/a/file.txt &&
- ! test -f a/a/file.txt
+ test_path_is_missing a/a/file.txt
'
test_expect_success 'mergetool produces no errors when keepBackup is used' '
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 78db65189e..d1393ef197 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -26,7 +26,7 @@ test_expect_success $PREREQ 'Setup helper tool' '
write_script fake.sendmail <<-\EOF &&
shift
output=1
- while test_path_is_file commandline$output
+ while test -f commandline$output
do
output=$(($output+1))
done
@@ -66,7 +66,7 @@ test_no_confirm () {
# Exit immediately to prevent hang if a no-confirm test fails
check_no_confirm () {
- if test_path_is_missing no_confirm_okay
+ if ! test -f no_confirm_okay
then
say 'confirm test failed; skipping remaining tests to prevent hanging'
PREREQ="$PREREQ,CHECK_NO_CONFIRM"
@@ -2722,7 +2722,7 @@ test_expect_success $PREREQ 'invoke hook' '
false
;;
esac &&
- test_path_is_file 0001-add-main.patch &&
+ test -f 0001-add-main.patch &&
grep "add main" "$1"
EOF
diff --git a/t/t9804-git-p4-label.sh b/t/t9804-git-p4-label.sh
index 3236457106..f64a11f85f 100755
--- a/t/t9804-git-p4-label.sh
+++ b/t/t9804-git-p4-label.sh
@@ -59,9 +59,9 @@ test_expect_success 'basic p4 labels' '
cd main &&
git checkout tag_tag_f1_only &&
- ! test -f f2 &&
+ test_path_is_missing f2 &&
git checkout tag_tag_with\$_shell_char &&
- test -f f1 && test -f f2 && test -f file_with_\$metachar &&
+ test_path_is_file f1 && test_path_is_file f2 && test_path_is_file file_with_\$metachar &&
git show tag_long_label | grep -q "A Label second line"
)
@@ -100,11 +100,11 @@ test_expect_failure 'two labels on the same changelist' '
git checkout tag_tag_f1_1 &&
ls &&
- test -f f1 &&
+ test_path_is_file f1 &&
git checkout tag_tag_f1_2 &&
ls &&
- test -f f1
+ test_path_is_file f1
)
'
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Update shell tests to use semantic functions
2026-09-04 20:35 ` [PATCH 1/2] Update shell " Mark C. Chu-Carroll via B4 Relay
@ 2026-09-05 2:17 ` Junio C Hamano
2026-09-07 12:10 ` Patrick Steinhardt
1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2026-09-05 2:17 UTC (permalink / raw)
To: Mark C. Chu-Carroll via B4 Relay; +Cc: git, Mark C. Chu-Carroll
"Mark C. Chu-Carroll via B4 Relay"
<devnull+markchucarroll.fastmail.com@kernel.org> writes:
> - if test_have_prereq MINGW && test -f /proc/$shell_pid/winpid
> + if test_have_prereq MINGW && test_path_is_file /proc/$shell_pid/winpid
This is Wrong.
First think what the point of "test_path_is_file" and other helpers
is. Once you understood them, you would never write them as part of
conditional expressions like the above one.
A conditional statement like this "if" does *not* want to shout when
the test condition it used to switch between its "then" (and "else"
if it has it) is not satisfied. If this "test -f" does not find the
named /proc/$shell_pid/winpid file, it does not mean that we
detected a breakage in the system that is being tested.
After looking at a handful of hunks from the top of this patch, it
seems there are many more similarly wrong conversions among them
than a few that are good, and I won't look at the remainder of the
[1/2] or [2/2]. Sifting the two large patches that lack sign-off
that span across many files and finding salvageable bits is not
something I would spend my weekend on.
This kind of conversion first needs to understand what each
invocation of "test -X" is really trying to check and why.
Brain-less mechanical conversion is not sufficient and will produce
a wrong conversion like the above one.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Update shell tests to use semantic functions
2026-09-04 20:35 ` [PATCH 1/2] Update shell " Mark C. Chu-Carroll via B4 Relay
2026-09-05 2:17 ` Junio C Hamano
@ 2026-09-07 12:10 ` Patrick Steinhardt
1 sibling, 0 replies; 5+ messages in thread
From: Patrick Steinhardt @ 2026-09-07 12:10 UTC (permalink / raw)
To: markchucarroll; +Cc: git
On Fri, Sep 04, 2026 at 04:35:52PM -0400, Mark C. Chu-Carroll via B4 Relay wrote:
> From: "Mark C. Chu-Carroll" <markchucarroll@fastmail.com>
>
> This updates an initial bash of shell tests to replace uses
> of "test -f" and "! test -f" with "test_path_is_file" and
> "test_path_is_missing".
The commit message doesn't quite match our conventions:
- We typically write the messages in imperative style, as if telling
the code to change.
- The subject should typically start with the subsystem that you're
changing, followed by a lower-case letter. So in your case, "t:"
would be a good prefix.
- The message should also briefly explain what the benefit of this
conversion is.
- You're missing the Signed-off-by line.
> t/t0031-lockfile-pid.sh | 2 +-
> t/t0200-gettext-basic.sh | 2 +-
> t/t1007-hash-object.sh | 6 +++---
> t/t2030-unresolve-info.sh | 8 ++++----
> t/t2201-add-update-typechange.sh | 2 +-
> t/t3300-funny-names.sh | 2 +-
> t/t3306-notes-prune.sh | 2 +-
> t/t3311-notes-merge-fanout.sh | 2 +-
> t/t4014-format-patch.sh | 6 +++---
> t/t4032-diff-inter-hunk-context.sh | 4 ++--
> t/t4102-apply-rename.sh | 2 +-
> t/t4131-apply-fake-ancestor.sh | 2 +-
> t/t4132-apply-removal.sh | 4 ++--
> t/t5300-pack-object.sh | 10 +++++-----
> t/t5301-sliding-window.sh | 4 ++--
> t/t5302-pack-index.sh | 8 ++++----
> t/t5502-quickfetch.sh | 2 +-
> t/t5510-fetch.sh | 8 ++++----
> t/t5516-fetch-push.sh | 2 +-
> t/t5534-push-signed.sh | 6 +++---
> t/t5550-http-fetch-dumb.sh | 2 +-
> t/t5604-clone-reference.sh | 2 +-
> t/t6500-gc.sh | 2 +-
> t/t7012-skip-worktree-writing.sh | 2 +-
> t/t7102-reset.sh | 2 +-
> t/t7104-reset-hard.sh | 2 +-
> t/t7113-post-index-change-hook.sh | 12 ++++++------
> t/t7201-co.sh | 6 +++---
> t/t7400-submodule-basic.sh | 10 +++++-----
> t/t7407-submodule-foreach.sh | 6 +++---
> t/t7412-submodule-absorbgitdirs.sh | 8 ++++----
> t/t7602-merge-octopus-many.sh | 2 +-
> t/t9001-send-email.sh | 6 +++---
> t/t9400-git-cvsserver-server.sh | 6 +++---
> 34 files changed, 76 insertions(+), 76 deletions(-)
I'd recommend significantly shrinking the number of files you convert to
at most a handful in this series. The conversion to use the
`test_path_*()` helpers is something that we mostly hand out to
newcomers as the usefulness of it is really rather in the educational
part rather than it bringing a lot of value to the Git project.
> diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
> index 463b38f990..e6d1fe3e13 100755
> --- a/t/t1007-hash-object.sh
> +++ b/t/t1007-hash-object.sh
> @@ -271,7 +271,7 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
>
> test_expect_success EXPENSIVE,SIZE_T_IS_64BIT \
> 'files over 4GB hash correctly via --stdin' '
> - { test -f big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
> + { test_path_is_file big || test-tool genzeros $((5*1024*1024*1024)) >big; } &&
> test_oid large5GB >expect &&
> git hash-object --stdin <big >actual &&
> test_cmp expect actual
This is wrong. The intent is that we only generate the file if we didn't
already do it beforehand, so it's a form of lazy creation. So it is
expected that the file may not exist, but with `test_path_is_file` we'd
now generate an error message if so.
Likewise for the subsequent changes in this fiel.
> diff --git a/t/t4032-diff-inter-hunk-context.sh b/t/t4032-diff-inter-hunk-context.sh
> index 7d443968e3..cc213c04a1 100755
> --- a/t/t4032-diff-inter-hunk-context.sh
> +++ b/t/t4032-diff-inter-hunk-context.sh
> @@ -28,7 +28,7 @@ t() {
> file=f$1
> expected=expected.$file.$3.$hunks
>
> - if ! test -f $file
> + if test_path_is_missing $file
> then
> f A $1 B >$file
> git add $file
> @@ -40,7 +40,7 @@ t() {
> test $(git $cmd $file | grep '^@@ ' | wc -l) = $hunks
> "
>
> - if test -f $expected
> + if test_path_is_file $expected
> then
> test_expect_success "$label: check output" "
> git $cmd $file | grep -v '^index ' >actual &&
Likewise, these here are expected cases where the file may be missing.
We shouldn't print an error message in such cases. There's also a couple
more such cases.
Thanks!
Patrick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-07 12:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04 20:35 [PATCH 0/2] Update tests to use semantic functions Mark C. Chu-Carroll via B4 Relay
2026-09-04 20:35 ` [PATCH 1/2] Update shell " Mark C. Chu-Carroll via B4 Relay
2026-09-05 2:17 ` Junio C Hamano
2026-09-07 12:10 ` Patrick Steinhardt
2026-09-04 20:35 ` [PATCH 2/2] Second batch of shell test migrations Mark C. Chu-Carroll via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox