git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Lars Schneider" <larsxschneider@gmail.com>
Subject: [PATCH 07/10] t2020: abstract away SHA-1 specific constants
Date: Sun, 25 Mar 2018 19:20:52 +0000	[thread overview]
Message-ID: <20180325192055.841459-8-sandals@crustytoothpaste.net> (raw)
In-Reply-To: <20180325192055.841459-1-sandals@crustytoothpaste.net>

Adjust the test so that it uses variables for the revisions we're
checking out instead of hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 t/t2020-checkout-detach.sh | 40 +++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh
index bb4f2e0c63..1fa670625c 100755
--- a/t/t2020-checkout-detach.sh
+++ b/t/t2020-checkout-detach.sh
@@ -189,8 +189,12 @@ test_expect_success 'no advice given for explicit detached head state' '
 # Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (new format)
 test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not asked to' "
 
+	commit=$(git rev-parse --short=12 master^) &&
+	commit2=$(git rev-parse --short=12 master~2) &&
+	commit3=$(git rev-parse --short=12 master~3) &&
+
 	# The first detach operation is more chatty than the following ones.
-	cat >1st_detach <<-'EOF' &&
+	cat >1st_detach <<-EOF &&
 	Note: checking out 'HEAD^'.
 
 	You are in 'detached HEAD' state. You can look around, make experimental
@@ -202,18 +206,18 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
 
 	  git checkout -b <new-branch-name>
 
-	HEAD is now at 7c7cd714e262 three
+	HEAD is now at \$commit three
 	EOF
 
 	# The remaining ones just show info about previous and current HEADs.
-	cat >2nd_detach <<-'EOF' &&
-	Previous HEAD position was 7c7cd714e262 three
-	HEAD is now at 139b20d8e6c5 two
+	cat >2nd_detach <<-EOF &&
+	Previous HEAD position was \$commit three
+	HEAD is now at \$commit2 two
 	EOF
 
-	cat >3rd_detach <<-'EOF' &&
-	Previous HEAD position was 139b20d8e6c5 two
-	HEAD is now at d79ce1670bdc one
+	cat >3rd_detach <<-EOF &&
+	Previous HEAD position was \$commit2 two
+	HEAD is now at \$commit3 one
 	EOF
 
 	reset &&
@@ -261,8 +265,12 @@ test_expect_success 'describe_detached_head prints no SHA-1 ellipsis when not as
 # Detached HEAD tests for GIT_PRINT_SHA1_ELLIPSIS (old format)
 test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked to' "
 
+	commit=$(git rev-parse --short=12 master^) &&
+	commit2=$(git rev-parse --short=12 master~2) &&
+	commit3=$(git rev-parse --short=12 master~3) &&
+
 	# The first detach operation is more chatty than the following ones.
-	cat >1st_detach <<-'EOF' &&
+	cat >1st_detach <<-EOF &&
 	Note: checking out 'HEAD^'.
 
 	You are in 'detached HEAD' state. You can look around, make experimental
@@ -274,18 +282,18 @@ test_expect_success 'describe_detached_head does print SHA-1 ellipsis when asked
 
 	  git checkout -b <new-branch-name>
 
-	HEAD is now at 7c7cd714e262... three
+	HEAD is now at \$commit... three
 	EOF
 
 	# The remaining ones just show info about previous and current HEADs.
-	cat >2nd_detach <<-'EOF' &&
-	Previous HEAD position was 7c7cd714e262... three
-	HEAD is now at 139b20d8e6c5... two
+	cat >2nd_detach <<-EOF &&
+	Previous HEAD position was \$commit... three
+	HEAD is now at \$commit2... two
 	EOF
 
-	cat >3rd_detach <<-'EOF' &&
-	Previous HEAD position was 139b20d8e6c5... two
-	HEAD is now at d79ce1670bdc... one
+	cat >3rd_detach <<-EOF &&
+	Previous HEAD position was \$commit2... two
+	HEAD is now at \$commit3... one
 	EOF
 
 	reset &&

  parent reply	other threads:[~2018-03-25 19:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-25 19:20 [PATCH 00/10] Hash-independent tests (part 1) brian m. carlson
2018-03-25 19:20 ` [PATCH 01/10] t1011: abstract away SHA-1-specific constants brian m. carlson
2018-03-25 19:20 ` [PATCH 02/10] t1304: " brian m. carlson
2018-03-25 19:20 ` [PATCH 03/10] t1300: " brian m. carlson
2018-03-25 19:20 ` [PATCH 04/10] t1405: sort reflog entries in a hash-independent way brian m. carlson
2018-03-26 22:18   ` Junio C Hamano
2018-03-26 23:02     ` brian m. carlson
2018-03-25 19:20 ` [PATCH 05/10] t1411: abstract away SHA-1-specific constants brian m. carlson
2018-03-25 19:20 ` [PATCH 06/10] t1507: " brian m. carlson
2018-03-25 19:20 ` brian m. carlson [this message]
2018-03-25 19:20 ` [PATCH 08/10] t2101: modernize test style brian m. carlson
2018-03-25 19:20 ` [PATCH 09/10] t2101: abstract away SHA-1-specific constants brian m. carlson
2018-03-25 19:20 ` [PATCH 10/10] t2107: " brian m. carlson
2018-03-26  2:10 ` [PATCH 00/10] Hash-independent tests (part 1) Eric Sunshine
2018-03-26  4:48   ` Junio C Hamano
2018-03-27 14:40     ` Johannes Schindelin
2018-03-28 16:58       ` Junio C Hamano
2018-03-29 14:01         ` Johannes Schindelin
2018-03-26 22:27   ` brian m. carlson
2018-03-27 14:30 ` Johannes Schindelin

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180325192055.841459-8-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=larsxschneider@gmail.com \
    --cc=pclouds@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).