All of lore.kernel.org
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: <git@vger.kernel.org>
Cc: Stefan Beller <stefanbeller@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH 07/15] t4011: abstract away SHA-1-specific constants
Date: Sat,  5 Oct 2019 21:12:01 +0000	[thread overview]
Message-ID: <20191005211209.18237-8-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20191005211209.18237-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/t4011-diff-symlink.sh | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index 5ae19b987d..b6934da266 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -10,10 +10,12 @@ test_description='Test diff of symlinks.
 . "$TEST_DIRECTORY"/diff-lib.sh
 
 test_expect_success 'diff new symlink and file' '
-	cat >expected <<-\EOF &&
+	symlink=$(git rev-parse --short \
+		$(printf xyzzy | git hash-object --stdin)) &&
+	cat >expected <<-EOF &&
 	diff --git a/frotz b/frotz
 	new file mode 120000
-	index 0000000..7c465af
+	index 0000000..$symlink
 	--- /dev/null
 	+++ b/frotz
 	@@ -0,0 +1 @@
@@ -21,7 +23,7 @@ test_expect_success 'diff new symlink and file' '
 	\ No newline at end of file
 	diff --git a/nitfol b/nitfol
 	new file mode 100644
-	index 0000000..7c465af
+	index 0000000..$symlink
 	--- /dev/null
 	+++ b/nitfol
 	@@ -0,0 +1 @@
@@ -46,10 +48,10 @@ test_expect_success 'diff unchanged symlink and file'  '
 '
 
 test_expect_success 'diff removed symlink and file' '
-	cat >expected <<-\EOF &&
+	cat >expected <<-EOF &&
 	diff --git a/frotz b/frotz
 	deleted file mode 120000
-	index 7c465af..0000000
+	index $symlink..0000000
 	--- a/frotz
 	+++ /dev/null
 	@@ -1 +0,0 @@
@@ -57,7 +59,7 @@ test_expect_success 'diff removed symlink and file' '
 	\ No newline at end of file
 	diff --git a/nitfol b/nitfol
 	deleted file mode 100644
-	index 7c465af..0000000
+	index $symlink..0000000
 	--- a/nitfol
 	+++ /dev/null
 	@@ -1 +0,0 @@
@@ -90,9 +92,11 @@ test_expect_success 'diff identical, but newly created symlink and file' '
 '
 
 test_expect_success 'diff different symlink and file' '
-	cat >expected <<-\EOF &&
+	new=$(git rev-parse --short \
+		$(printf yxyyz | git hash-object --stdin)) &&
+	cat >expected <<-EOF &&
 	diff --git a/frotz b/frotz
-	index 7c465af..df1db54 120000
+	index $symlink..$new 120000
 	--- a/frotz
 	+++ b/frotz
 	@@ -1 +1 @@
@@ -101,7 +105,7 @@ test_expect_success 'diff different symlink and file' '
 	+yxyyz
 	\ No newline at end of file
 	diff --git a/nitfol b/nitfol
-	index 7c465af..df1db54 100644
+	index $symlink..$new 100644
 	--- a/nitfol
 	+++ b/nitfol
 	@@ -1 +1 @@
@@ -137,14 +141,17 @@ test_expect_success SYMLINKS 'setup symlinks with attributes' '
 '
 
 test_expect_success SYMLINKS 'symlinks do not respect userdiff config by path' '
-	cat >expect <<-\EOF &&
+	file=$(git rev-parse --short $(git hash-object file.bin)) &&
+	link=$(git rev-parse --short \
+		$(printf file.bin | git hash-object --stdin)) &&
+	cat >expect <<-EOF &&
 	diff --git a/file.bin b/file.bin
 	new file mode 100644
-	index 0000000..d95f3ad
+	index 0000000..$file
 	Binary files /dev/null and b/file.bin differ
 	diff --git a/link.bin b/link.bin
 	new file mode 120000
-	index 0000000..dce41ec
+	index 0000000..$link
 	--- /dev/null
 	+++ b/link.bin
 	@@ -0,0 +1 @@

  parent reply	other threads:[~2019-10-05 21:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05 21:11 [PATCH 00/15] SHA-256 test fixes, part 6 brian m. carlson
2019-10-05 21:11 ` [PATCH 01/15] t/oid-info: allow looking up hash algorithm name brian m. carlson
2019-10-05 21:11 ` [PATCH 02/15] t/oid-info: add empty tree and empty blob values brian m. carlson
2019-10-05 21:11 ` [PATCH 03/15] rev-parse: add an --object-format option brian m. carlson
2019-10-08 11:51   ` Derrick Stolee
2019-10-08 19:31     ` brian m. carlson
2019-10-05 21:11 ` [PATCH 04/15] t1305: avoid comparing extensions brian m. carlson
2019-10-05 21:11 ` [PATCH 05/15] t3429: remove SHA1 annotation brian m. carlson
2019-10-05 21:12 ` [PATCH 06/15] t4010: abstract away SHA-1-specific constants brian m. carlson
2019-10-05 21:12 ` brian m. carlson [this message]
2019-10-08 12:21   ` [PATCH 07/15] t4011: " Derrick Stolee
2019-10-08 12:33     ` Bert Wesarg
2019-10-08 12:38       ` Derrick Stolee
2019-10-08 19:40       ` brian m. carlson
2019-10-05 21:12 ` [PATCH 08/15] t4015: " brian m. carlson
2019-10-08 12:31   ` Derrick Stolee
2019-10-05 21:12 ` [PATCH 09/15] t4027: make hash-size independent brian m. carlson
2019-10-05 21:12 ` [PATCH 10/15] t4034: abstract away SHA-1-specific constants brian m. carlson
2019-10-05 21:12 ` [PATCH 11/15] t4038: abstract away SHA-1 specific constants brian m. carlson
2019-10-05 21:12 ` [PATCH 12/15] t4039: abstract away SHA-1-specific constants brian m. carlson
2019-10-05 21:12 ` [PATCH 13/15] t4044: update test to work with SHA-256 brian m. carlson
2019-10-05 21:12 ` [PATCH 14/15] t4045: make hash-size independent brian m. carlson
2019-10-05 21:12 ` [PATCH 15/15] t4048: abstract away SHA-1-specific constants brian m. carlson
2019-10-08 12:40 ` [PATCH 00/15] SHA-256 test fixes, part 6 Derrick Stolee

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=20191005211209.18237-8-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=Johannes.Schindelin@gmx.de \
    --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 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.