From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: <git@vger.kernel.org>
Cc: Derrick Stolee <dstolee@microsoft.com>,
Stefan Beller <stefanbeller@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH v2 06/15] t4010: abstract away SHA-1-specific constants
Date: Mon, 28 Oct 2019 00:58:58 +0000 [thread overview]
Message-ID: <20191028005907.24985-7-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20191028005907.24985-1-sandals@crustytoothpaste.net>
Adjust the test so that it computes variables for object IDs instead of
using hard-coded hashes.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
t/t4010-diff-pathspec.sh | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh
index 281f8fad0c..e5ca359edf 100755
--- a/t/t4010-diff-pathspec.sh
+++ b/t/t4010-diff-pathspec.sh
@@ -17,11 +17,15 @@ test_expect_success \
'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
@@ -31,32 +35,32 @@ test_expect_success \
'git diff-index --cached $tree -- path >current &&
compare_diff_raw current expected'
-cat >expected <<\EOF
-:100644 100644 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
+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 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
+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 766498d93a4b06057a8e49d23f4068f1170ff38f 0a41e115ab61be0328a19b29f18cdcb49338d516 M path1/file1
+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 8e4020bb5a8d8c873b25de15933e75cc0fc275df dca6b92303befc93086aa025d90a5facd7eb2812 M file0
+cat >expected <<EOF
+:100644 100644 $before0 $after0 M file0
EOF
test_expect_success \
'limit to file0 should show file0' \
next prev parent reply other threads:[~2019-10-28 0:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 0:58 [PATCH v2 00/15] SHA-256 test fixes, part 6 brian m. carlson
2019-10-28 0:58 ` [PATCH v2 01/15] t/oid-info: allow looking up hash algorithm name brian m. carlson
2019-10-28 0:58 ` [PATCH v2 02/15] t/oid-info: add empty tree and empty blob values brian m. carlson
2019-10-28 0:58 ` [PATCH v2 03/15] rev-parse: add a --show-object-format option brian m. carlson
2019-10-28 0:58 ` [PATCH v2 04/15] t1305: avoid comparing extensions brian m. carlson
2019-10-28 0:58 ` [PATCH v2 05/15] t3429: remove SHA1 annotation brian m. carlson
2019-10-28 0:58 ` brian m. carlson [this message]
2019-10-28 0:58 ` [PATCH v2 07/15] t4011: abstract away SHA-1-specific constants brian m. carlson
2019-10-28 2:56 ` Junio C Hamano
2019-10-28 23:59 ` brian m. carlson
2019-10-28 0:59 ` [PATCH v2 08/15] t4015: " brian m. carlson
2019-10-28 0:59 ` [PATCH v2 09/15] t4027: make hash-size independent brian m. carlson
2019-10-28 0:59 ` [PATCH v2 10/15] t4034: abstract away SHA-1-specific constants brian m. carlson
2019-10-28 0:59 ` [PATCH v2 11/15] t4038: abstract away SHA-1 specific constants brian m. carlson
2019-10-28 0:59 ` [PATCH v2 12/15] t4039: abstract away SHA-1-specific constants brian m. carlson
2019-10-28 0:59 ` [PATCH v2 13/15] t4044: update test to work with SHA-256 brian m. carlson
2019-10-28 0:59 ` [PATCH v2 14/15] t4045: make hash-size independent brian m. carlson
2019-10-28 0:59 ` [PATCH v2 15/15] t4048: abstract away SHA-1-specific constants brian m. carlson
2019-10-29 2:26 ` [PATCH v2 00/15] SHA-256 test fixes, part 6 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=20191028005907.24985-7-sandals@crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=stefanbeller@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).