All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sampriyo Guin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>,
	Karthik Nayak <karthik.188@gmail.com>,
	Sampriyo Guin <sampriyoguin@gmail.com>,
	rimo <sampriyoguin@gmail.com>
Subject: [PATCH] [GSoC Patch] Modernize Test Path Checking: test -(e|f|d)
Date: Tue, 18 Mar 2025 11:58:31 +0000	[thread overview]
Message-ID: <pull.1918.git.git.1742299111861.gitgitgadget@gmail.com> (raw)

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

             reply	other threads:[~2025-03-18 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 11:58 Sampriyo Guin via GitGitGadget [this message]
2025-03-18 17:39 ` [PATCH] [GSoC Patch] Modernize Test Path Checking: test -(e|f|d) Eric Sunshine
2025-03-18 19:34   ` Junio C Hamano
2025-03-18 21:36     ` Eric Sunshine
2025-03-24 14:23       ` Karthik Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1918.git.git.1742299111861.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=ps@pks.im \
    --cc=sampriyoguin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.