From: "krush11 via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Krushnal Patel <krushnalpatel11@gmail.com>,
krush11 <krushnalpatel11@gmail.com>
Subject: [PATCH v2 1/2] replace test -f with test_path_is_file
Date: Fri, 19 Mar 2021 19:24:52 +0000 [thread overview]
Message-ID: <e5f92e3882cd32627d1dcba1271263c93b699b21.1616181893.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.982.v2.git.git.1616181893.gitgitgadget@gmail.com>
From: krush11 <krushnalpatel11@gmail.com>
Although has the same functionality as test_path_is_file(), in
the case where test_path_is_file() fails, we get much better debugging
information.
Replace with test_path_is_file so that future developers
will have a better experience debugging these test cases.
Signed-off-by: Krushnal Patel <krushnalpatel11@gmail.com>
---
t/t7300-clean.sh | 276 +++++++++++++++++++++++------------------------
1 file changed, 138 insertions(+), 138 deletions(-)
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index a74816ca8b46..a599c4210085 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -28,15 +28,15 @@ test_expect_success 'git clean with skip-worktree .gitignore' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.out &&
test ! -f src/part3.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so &&
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so &&
git update-index --no-skip-worktree .gitignore &&
git checkout .gitignore
'
@@ -46,15 +46,15 @@ test_expect_success 'git clean' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.out &&
test ! -f src/part3.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -63,15 +63,15 @@ test_expect_success 'git clean src/' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean src/ &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
test ! -f src/part3.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -80,15 +80,15 @@ test_expect_success 'git clean src/ src/' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean src/ src/ &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
test ! -f src/part3.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -97,16 +97,16 @@ test_expect_success 'git clean with prefix' '
mkdir -p build docs src/test &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c &&
(cd src/ && git clean) &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
test ! -f src/part3.c &&
- test -f src/test/1.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file src/test/1.c &&
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -162,16 +162,16 @@ test_expect_success 'git clean -d with prefix and path' '
mkdir -p build docs src/feature &&
touch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so &&
(cd src/ && git clean -d feature/) &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
- test -f src/part3.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
+ test_path_is_file src/part3.c &&
test ! -f src/feature/file.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -181,16 +181,16 @@ test_expect_success SYMLINKS 'git clean symbolic link' '
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
ln -s docs/manual.txt src/part4.c &&
git clean &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.out &&
test ! -f src/part3.c &&
test ! -f src/part4.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -198,13 +198,13 @@ test_expect_success 'git clean with wildcard' '
touch a.clean b.clean other.c &&
git clean "*.clean" &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.clean &&
test ! -f b.clean &&
- test -f other.c
+ test_path_is_file other.c
'
@@ -213,15 +213,15 @@ test_expect_success 'git clean -n' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -n &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
- test -f src/part3.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
+ test_path_is_file src/part3.c &&
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -230,15 +230,15 @@ test_expect_success 'git clean -d' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -d &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.out &&
test ! -f src/part3.c &&
test ! -d docs &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -247,16 +247,16 @@ test_expect_success 'git clean -d src/ examples/' '
mkdir -p build docs examples &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c &&
git clean -d src/ examples/ &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
test ! -f src/part3.c &&
test ! -f examples/1.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -265,15 +265,15 @@ test_expect_success 'git clean -x' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -x &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.out &&
test ! -f src/part3.c &&
- test -f docs/manual.txt &&
+ test_path_is_file docs/manual.txt &&
test ! -f obj.o &&
- test -f build/lib.so
+ test_path_is_file build/lib.so
'
@@ -282,10 +282,10 @@ test_expect_success 'git clean -d -x' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -d -x &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.out &&
test ! -f src/part3.c &&
test ! -d docs &&
@@ -299,12 +299,12 @@ test_expect_success 'git clean -d -x with ignored tracked directory' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -d -x -e src &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.out &&
- test -f src/part3.c &&
+ test_path_is_file src/part3.c &&
test ! -d docs &&
test ! -f obj.o &&
test ! -d build
@@ -316,15 +316,15 @@ test_expect_success 'git clean -X' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -X &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
- test -f src/part3.c &&
- test -f docs/manual.txt &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
+ test_path_is_file src/part3.c &&
+ test_path_is_file docs/manual.txt &&
test ! -f obj.o &&
- test -f build/lib.so
+ test_path_is_file build/lib.so
'
@@ -333,13 +333,13 @@ test_expect_success 'git clean -d -X' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -d -X &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
- test -f src/part3.c &&
- test -f docs/manual.txt &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
+ test_path_is_file src/part3.c &&
+ test_path_is_file docs/manual.txt &&
test ! -f obj.o &&
test ! -d build
@@ -350,13 +350,13 @@ test_expect_success 'git clean -d -X with ignored tracked directory' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -d -X -e src &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
test ! -f src/part3.c &&
- test -f docs/manual.txt &&
+ test_path_is_file docs/manual.txt &&
test ! -f obj.o &&
test ! -d build
@@ -381,29 +381,29 @@ test_expect_success 'clean.requireForce and -n' '
mkdir -p build docs &&
touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
git clean -n &&
- test -f Makefile &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
- test -f a.out &&
- test -f src/part3.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file Makefile &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
+ test_path_is_file a.out &&
+ test_path_is_file src/part3.c &&
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
test_expect_success 'clean.requireForce and -f' '
git clean -f &&
- test -f README &&
- test -f src/part1.c &&
- test -f src/part2.c &&
+ test_path_is_file README &&
+ test_path_is_file src/part1.c &&
+ test_path_is_file src/part2.c &&
test ! -f a.out &&
test ! -f src/part3.c &&
- test -f docs/manual.txt &&
- test -f obj.o &&
- test -f build/lib.so
+ test_path_is_file docs/manual.txt &&
+ test_path_is_file obj.o &&
+ test_path_is_file build/lib.so
'
@@ -446,10 +446,10 @@ test_expect_success 'nested git work tree' '
test_commit deeply.nested deeper.world
) &&
git clean -f -d &&
- test -f foo/.git/index &&
- test -f foo/hello.world &&
- test -f baz/boo/.git/index &&
- test -f baz/boo/deeper.world &&
+ test_path_is_file foo/.git/index &&
+ test_path_is_file foo/hello.world &&
+ test_path_is_file baz/boo/.git/index &&
+ test_path_is_file baz/boo/deeper.world &&
! test -d bar
'
--
gitgitgadget
next prev parent reply other threads:[~2021-03-19 19:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-19 9:52 [PATCH] replace test -f with test_path_is_file Krushnal Patel via GitGitGadget
2021-03-19 18:04 ` Junio C Hamano
2021-03-19 19:24 ` [PATCH v2 0/2] " Krushnal Patel via GitGitGadget
2021-03-19 19:24 ` krush11 via GitGitGadget [this message]
2021-03-19 19:24 ` [PATCH v2 2/2] replaced test -f and test ! -f krush11 via GitGitGadget
2021-03-19 20:34 ` Junio C Hamano
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=e5f92e3882cd32627d1dcba1271263c93b699b21.1616181893.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=krushnalpatel11@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 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).