git.vger.kernel.org archive mirror
 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>,
	"Jialuo She [ ]" <shejialuo@gmail.com>,
	"Christian Couder [ ]" <christian.couder@gmail.com>,
	"Ghanshyam Thakkar [ ]" <shyamthakkar001@gmail.com>,
	"Eric Sunshine [ ]" <sunshine@sunshineco.com>,
	Sampriyo Guin <sampriyoguin@gmail.com>,
	Sampriyo Guin <sampriyoguin@gmail.com>
Subject: [PATCH v2] [GSoC Patch v2]Modernize Test Path Checking: test -(e|f|d)
Date: Wed, 19 Mar 2025 06:03:57 +0000	[thread overview]
Message-ID: <pull.1923.v2.git.git.1742364237330.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1923.git.git.1742329571265.gitgitgadget@gmail.com>

From: Sampriyo Guin <sampriyoguin@gmail.com>

test -f changed to test_path_is_file
test -f does not provide a proper error message so test_path_is_file used
Changed for t/t2003-checkout-cache-mkdir.sh

Signed-off-by: Sampriyo Guin <sampriyoguin@gmail.com>
---
    [GSoC Patch v2] Modernize Test Path Checking in Git’s Test Suite
    
    test -(e|f|d) does not provide a proper error message when hit test
    failures. So test_path_exists, test_path_is_dir, test_path_is_file used.
    
    Added changes for files from t/t0007-git-var.sh to
    t/t1700-split-index.sh.
    
    Signed-off-by: Sampriyo Guin <sampriyoguin@gmail.com>

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1923%2FRimoGuin%2Fmaster-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1923/RimoGuin/master-v2
Pull-Request: https://github.com/git/git/pull/1923

Range-diff vs v1:

 1:  432dbe6fb82 < -:  ----------- [GSoC Patch] Modernize Test Path Checking in Git’s Test Suite
 -:  ----------- > 1:  0f74a82d681 [GSoC Patch v2]Modernize Test Path Checking: test -(e|f|d)


 t/t2003-checkout-cache-mkdir.sh | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh
index ff163cf6750..9d2f59e0d78 100755
--- a/t/t2003-checkout-cache-mkdir.sh
+++ b/t/t2003-checkout-cache-mkdir.sh
@@ -24,16 +24,16 @@ 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 ! -h path1 && test_path_is_dir path1 &&
+	test_path_is_file path1/file1 && test ! -f 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_path_is_file path2/path0 &&
+	test_path_is_file path2/path1/file1 &&
 	test ! -f path0 &&
 	test ! -f path1/file1
 '
@@ -41,8 +41,8 @@ test_expect_success 'use --prefix=path2/' '
 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_path_is_file tmp-path0 &&
+	test_path_is_file tmp-path1/file1 &&
 	test ! -f path0 &&
 	test ! -f path1/file1
 '
@@ -52,8 +52,8 @@ 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_path_is_file tmp-path0 &&
+	test_path_is_file tmp-path1/file1 &&
 	test ! -f path0 &&
 	test ! -f path1/file1
 '
@@ -63,9 +63,9 @@ 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_path_is_dir tmp1/orary &&
+	test_path_is_file tmp1/orary/path0 &&
+	test_path_is_file tmp1/orary/path1/file1 &&
 	test -h tmp
 '
 
@@ -74,8 +74,8 @@ 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_path_is_file tmp1/orary-path0 &&
+	test_path_is_file tmp1/orary-path1/file1 &&
 	test -h tmp
 '
 
@@ -84,10 +84,10 @@ 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_path_is_file tmp-path0 &&
 	test ! -h tmp-path1 &&
-	test -d tmp-path1 &&
-	test -f tmp-path1/file1
+	test_path_is_dir tmp-path1 &&
+	test_path_is_file tmp-path1/file1
 '
 
 test_expect_success 'apply filter from working tree .gitattributes with --prefix' '

base-commit: 683c54c999c301c2cd6f715c411407c413b1d84e
-- 
gitgitgadget

      parent reply	other threads:[~2025-03-19  6:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 20:26 [PATCH] [GSoC Patch] Modernize Test Path Checking in Git’s Test Suite Sampriyo Guin via GitGitGadget
2025-03-18 21:14 ` Junio C Hamano
2025-03-18 21:49   ` Eric Sunshine
2025-03-18 23:53     ` Junio C Hamano
2025-03-19  6:03 ` Sampriyo Guin via GitGitGadget [this message]

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.1923.v2.git.git.1742364237330.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=ps@pks.im \
    --cc=sampriyoguin@gmail.com \
    --cc=shejialuo@gmail.com \
    --cc=shyamthakkar001@gmail.com \
    --cc=sunshine@sunshineco.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).