git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] [GSoC Patch] Modernize Test Path Checking: test -(e|f|d)

From
SGSampriyo Guin via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 18, 2025, 11:58 UTC
Message-ID
<pull.1918.git.git.1742299111861.gitgitgadget@gmail.com>
From: rimo <sampriyoguin@gmail.com>

test -e changed to test_path_exists test -f changed to test_path_is_file

Signed-off-by: Sampriyo Guin <sampriyoguin@gmail.com>
---
    [GSoC Patch] Modernize Test Path Checking in Git’s Test Suite
    
    This is my first git contribution. A simple fix as specified in Git
    Microprojects. I have tested using Github Actions on my private
    repository. Your comments and feedbacks are much appreciated. Thanks!
    
    , Jialuo She shejialuo@gmail.com , Christian Couder
    christian.couder@gmail.com, Ghanshyam Thakkar shyamthakkar001@gmail.com
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1918%2FRimoGuin%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1918/RimoGuin/master-v1
Pull-Request: https://github.com/git/git/pull/1918
 t/chainlint/chained-subshell.expect | 2 +-
 t/chainlint/chained-subshell.test   | 2 +-
 t/chainlint/function.expect         | 2 +-
 t/chainlint/function.test           | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/chainlint/chained-subshell.expect b/t/chainlint/chained-subshell.expect
index 93fb1a6578b..76393efcd20 100644
--- a/t/chainlint/chained-subshell.expect
+++ b/t/chainlint/chained-subshell.expect
@@ -5,6 +5,6 @@
 6 ) &&
 7 
 8 cut "-d " -f actual | (read s1 s2 s3 &&
-9 test -f $s1 ?!LINT: missing '&&'?!
+9 test_path_is_file $s1 ?!LINT: missing '&&'?!
 10 test $(cat $s2) = tree2path1 &&
 11 test $(cat $s3) = tree3path1)
diff --git a/t/chainlint/chained-subshell.test b/t/chainlint/chained-subshell.test
index 1f11f653982..997f30eadd7 100644
--- a/t/chainlint/chained-subshell.test
+++ b/t/chainlint/chained-subshell.test
@@ -8,7 +8,7 @@ mkdir sub && (
 
 # LINT: preceding command pipes to subshell on same line
 cut "-d " -f actual | (read s1 s2 s3 &&
-test -f $s1
+test_path_is_file $s1
 test $(cat $s2) = tree2path1 &&
 # LINT: closing subshell ")" correctly detected on same line as "$(...)"
 test $(cat $s3) = tree3path1)
diff --git a/t/chainlint/function.expect b/t/chainlint/function.expect
index 9e46a3554a1..2edbeb5e4e2 100644
--- a/t/chainlint/function.expect
+++ b/t/chainlint/function.expect
@@ -4,7 +4,7 @@
 5 
 6 remove_object() {
 7 	file=$(sha1_file "$*") &&
-8 	test -e "$file" ?!LINT: missing '&&'?!
+8 	test_path_exists "$file" ?!LINT: missing '&&'?!
 9 	rm -f "$file"
 10 } ?!LINT: missing '&&'?!
 11 
diff --git a/t/chainlint/function.test b/t/chainlint/function.test
index 763fcf3f878..2f2a5c251f4 100644
--- a/t/chainlint/function.test
+++ b/t/chainlint/function.test
@@ -7,7 +7,7 @@ sha1_file() {
 # LINT: broken &&-chain in function and after function
 remove_object() {
 	file=$(sha1_file "$*") &&
-	test -e "$file"
+	test_path_exists "$file"
 	rm -f "$file"
 }
 

base-commit: 683c54c999c301c2cd6f715c411407c413b1d84e
-- 
gitgitgadget
Next: Eric Sunshine
Message 1 of 5 in “Modernize Test Path Checking: test -(e|f|d)”
  1. [GSoC Patch] Modernize Test Path Checking: test -(e|f|d)Sampriyo Guin via GitGitGadget, Mar 18, 2025
  2. Eric SunshineMar 18, 2025
  3. Junio C HamanoMar 18, 2025
  4. Eric SunshineMar 18, 2025
  5. Karthik NayakMar 24, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.