From: "Mark C. Chu-Carroll via B4 Relay" <devnull+markchucarroll.fastmail.com@kernel.org>
To: git@vger.kernel.org
Cc: "Mark C. Chu-Carroll" <markchucarroll@fastmail.com>
Subject: [PATCH v2 3/3] Update t4010 to use modern style.
Date: Thu, 10 Sep 2026 13:07:35 -0400 [thread overview]
Message-ID: <20260910-modernize-t4001-v2-3-ac53e9f5d717@fastmail.com> (raw)
In-Reply-To: <20260910-modernize-t4001-v2-0-ac53e9f5d717@fastmail.com>
From: "Mark C. Chu-Carroll" <markchucarroll@fastmail.com>
---
t/t4010-diff-pathspec.sh | 88 +++++++++++++++++-------------------------------
1 file changed, 31 insertions(+), 57 deletions(-)
diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh
index 8d980823b0..76ddd3ff4e 100755
--- a/t/t4010-diff-pathspec.sh
+++ b/t/t4010-diff-pathspec.sh
@@ -13,60 +13,34 @@ Prepare:
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
-test_expect_success \
- setup \
- 'echo frotz >file0 &&
- mkdir path1 &&
- echo rezrov >path1/file1 &&
- before0=$(git hash-object file0) &&
- before1=$(git hash-object path1/file1) &&
- git update-index --add file0 path1/file1 &&
- tree=$(git write-tree) &&
- echo "$tree" &&
- echo nitfol >file0 &&
- echo yomin >path1/file1 &&
- after0=$(git hash-object file0) &&
- after1=$(git hash-object path1/file1) &&
- git update-index file0 path1/file1'
-
-cat >expected <<\EOF
-EOF
-test_expect_success \
- 'limit to path should show nothing' \
- 'git diff-index --cached $tree -- path >current &&
- compare_diff_raw current expected'
-
-cat >expected <<EOF
-:100644 100644 $before1 $after1 M path1/file1
-EOF
-test_expect_success \
- 'limit to path1 should show path1/file1' \
- 'git diff-index --cached $tree -- path1 >current &&
- compare_diff_raw current expected'
-
-cat >expected <<EOF
-:100644 100644 $before1 $after1 M path1/file1
-EOF
-test_expect_success \
- 'limit to path1/ should show path1/file1' \
- 'git diff-index --cached $tree -- path1/ >current &&
- compare_diff_raw current expected'
-
-cat >expected <<EOF
-:100644 100644 $before1 $after1 M path1/file1
-EOF
-test_expect_success \
- '"*file1" should show path1/file1' \
- 'git diff-index --cached $tree -- "*file1" >current &&
- compare_diff_raw current expected'
-
-cat >expected <<EOF
-:100644 100644 $before0 $after0 M file0
-EOF
-test_expect_success \
- 'limit to file0 should show file0' \
- 'git diff-index --cached $tree -- file0 >current &&
- compare_diff_raw current expected'
+
+test_expect_success 'limit to path should show nothing' '
+ echo frotz >file0 &&
+ mkdir path1 &&
+ echo rezrov >path1/file1 &&
+ before0=$(git hash-object file0) &&
+ before1=$(git hash-object path1/file1) &&
+ git update-index --add file0 path1/file1 &&
+ tree=$(git write-tree) &&
+ echo "$tree" &&
+ echo nitfol >file0 &&
+ echo yomin >path1/file1 &&
+ after0=$(git hash-object file0) &&
+ after1=$(git hash-object path1/file1) &&
+ git update-index file0 path1/file1 &&
+ : >expected &&
+ git diff-index --cached $tree -- path >current &&
+ compare_diff_raw current expected
+'
+
+test_expect_success 'limit to path1 should show path1/file1' '
+ cat >expected <<-EOF &&
+ :100644 100644 $before1 $after1 M path1/file1
+ EOF
+
+ git diff-index --cached $tree -- path1 >current &&
+ compare_diff_raw current expected
+'
test_expect_success 'limit to path1/ should show path1/file1' '
cat >expected <<-EOF &&
@@ -80,7 +54,7 @@ test_expect_success '"*file1" should show path1/file1' '
cat >expected <<-EOF &&
:100644 100644 $before1 $after1 M path1/file1
EOF
-
+
git diff-index --cached $tree -- "*file1" >current &&
compare_diff_raw current expected
'
@@ -89,13 +63,13 @@ test_expect_success 'limit to file0 should show file0' '
cat >expected <<-EOF &&
:100644 100644 $before0 $after0 M file0
EOF
-
+
git diff-index --cached $tree -- file0 >current &&
compare_diff_raw current expected
'
test_expect_success 'limit to file0/ should emit nothing.' '
- : >expected &&
+ : >expected &&
git diff-index --cached $tree -- file0/ >current &&
compare_diff_raw current expected
'
--
2.53.0
prev parent reply other threads:[~2026-09-10 17:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 19:44 [PATCH 0/3] Update t40* tests to use modern style Mark C. Chu-Carroll via B4 Relay
2026-09-08 19:44 ` [PATCH 1/3] Update t4001 to use modern syntax Mark C. Chu-Carroll via B4 Relay
2026-09-08 20:48 ` Junio C Hamano
2026-09-08 19:44 ` [PATCH 2/3] Update t4009 to use modern style Mark C. Chu-Carroll via B4 Relay
2026-09-08 19:44 ` [PATCH 3/3] Update t4010 " Mark C. Chu-Carroll via B4 Relay
2026-09-10 17:07 ` [PATCH v2 0/3] Update t40* tests " Mark C. Chu-Carroll via B4 Relay
2026-09-10 17:07 ` [PATCH v2 1/3] Update t4001 to use modern syntax Mark C. Chu-Carroll via B4 Relay
2026-09-10 17:56 ` Junio C Hamano
2026-09-10 17:07 ` [PATCH v2 2/3] Update t4009 to use modern style Mark C. Chu-Carroll via B4 Relay
2026-09-10 17:07 ` Mark C. Chu-Carroll via B4 Relay [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=20260910-modernize-t4001-v2-3-ac53e9f5d717@fastmail.com \
--to=devnull+markchucarroll.fastmail.com@kernel.org \
--cc=git@vger.kernel.org \
--cc=markchucarroll@fastmail.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