git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood@talktalk.net>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	"Brian M. Carlson" <sandals@crustytoothpaste.net>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: [PATCH v2 4/9] t3701: don't hard code sha1 hash values
Date: Mon, 19 Feb 2018 11:29:05 +0000	[thread overview]
Message-ID: <20180219112910.24471-5-phillip.wood@talktalk.net> (raw)
In-Reply-To: <20180219112910.24471-1-phillip.wood@talktalk.net>

From: Phillip Wood <phillip.wood@dunelm.org.uk>

Purge the index lines from diffs so we're not hard coding sha1 hash
values in the expected output.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
 t/t3701-add-interactive.sh | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index b73a9598ab3eaed074735e99f3dcbc8f88d86f4c..70748393f28c93f4bc5d43b07bd96bd208aba3e9 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -24,7 +24,6 @@ test_expect_success 'status works (initial)' '
 test_expect_success 'setup expected' '
 	cat >expected <<-EOF
 	new file mode 100644
-	index 0000000..d95f3ad
 	--- /dev/null
 	+++ b/file
 	@@ -0,0 +1 @@
@@ -34,7 +33,7 @@ test_expect_success 'setup expected' '
 
 test_expect_success 'diff works (initial)' '
 	(echo d; echo 1) | git add -i >output &&
-	sed -ne "/new file/,/content/p" <output >diff &&
+	sed -ne /^index/d -e "/new file/,/content/p" <output >diff &&
 	test_cmp expected diff
 '
 test_expect_success 'revert works (initial)' '
@@ -60,7 +59,6 @@ test_expect_success 'status works (commit)' '
 
 test_expect_success 'setup expected' '
 	cat >expected <<-EOF
-	index 180b47c..b6f2c08 100644
 	--- a/file
 	+++ b/file
 	@@ -1 +1,2 @@
@@ -71,7 +69,7 @@ test_expect_success 'setup expected' '
 
 test_expect_success 'diff works (commit)' '
 	(echo d; echo 1) | git add -i >output &&
-	sed -ne "/^index/,/content/p" <output >diff &&
+	sed -ne "/^---/,/content/p" <output >diff &&
 	test_cmp expected diff
 '
 test_expect_success 'revert works (commit)' '
@@ -90,7 +88,7 @@ test_expect_success 'setup expected' '
 test_expect_success 'dummy edit works' '
 	test_set_editor : &&
 	(echo e; echo a) | git add -p &&
-	git diff > diff &&
+	git diff | sed /^index/d >diff &&
 	test_cmp expected diff
 '
 
@@ -145,7 +143,6 @@ test_expect_success 'setup patch' '
 test_expect_success 'setup expected' '
 	cat >expected <<-EOF
 	diff --git a/file b/file
-	index b5dd6c9..f910ae9 100644
 	--- a/file
 	+++ b/file
 	@@ -1,4 +1,4 @@
@@ -159,7 +156,7 @@ test_expect_success 'setup expected' '
 
 test_expect_success 'real edit works' '
 	(echo e; echo n; echo d) | git add -p &&
-	git diff >output &&
+	git diff | sed /^index/d >output &&
 	test_cmp expected output
 '
 
@@ -168,10 +165,10 @@ test_expect_success 'skip files similarly as commit -a' '
 	echo file >.gitignore &&
 	echo changed >file &&
 	echo y | git add -p file &&
-	git diff >output &&
+	git diff | sed /^index/d >output &&
 	git reset &&
 	git commit -am commit &&
-	git diff >expected &&
+	git diff | sed /^index/d >expected &&
 	test_cmp expected output &&
 	git reset --hard HEAD^
 '
@@ -217,7 +214,6 @@ test_expect_success 'setup again' '
 # Write the patch file with a new line at the top and bottom
 test_expect_success 'setup patch' '
 	cat >patch <<-EOF
-	index 180b47c..b6f2c08 100644
 	--- a/file
 	+++ b/file
 	@@ -1,2 +1,4 @@
@@ -232,7 +228,6 @@ test_expect_success 'setup patch' '
 test_expect_success 'setup expected' '
 	cat >expected <<-EOF
 	diff --git a/file b/file
-	index b6f2c08..61b9053 100755
 	--- a/file
 	+++ b/file
 	@@ -1,2 +1,4 @@
@@ -248,15 +243,14 @@ test_expect_success 'add first line works' '
 	git commit -am "clear local changes" &&
 	git apply patch &&
 	(echo s; echo y; echo y) | git add -p file &&
-	git diff --cached > diff &&
+	git diff --cached | sed /^index/d >diff &&
 	test_cmp expected diff
 '
 
 test_expect_success 'setup expected' '
 	cat >expected <<-EOF
 	diff --git a/non-empty b/non-empty
 	deleted file mode 100644
-	index d95f3ad..0000000
 	--- a/non-empty
 	+++ /dev/null
 	@@ -1 +0,0 @@
@@ -271,15 +265,14 @@ test_expect_success 'deleting a non-empty file' '
 	git commit -m non-empty &&
 	rm non-empty &&
 	echo y | git add -p non-empty &&
-	git diff --cached >diff &&
+	git diff --cached | sed /^index/d >diff &&
 	test_cmp expected diff
 '
 
 test_expect_success 'setup expected' '
 	cat >expected <<-EOF
 	diff --git a/empty b/empty
 	deleted file mode 100644
-	index e69de29..0000000
 	EOF
 '
 
@@ -290,7 +283,7 @@ test_expect_success 'deleting an empty file' '
 	git commit -m empty &&
 	rm empty &&
 	echo y | git add -p empty &&
-	git diff --cached >diff &&
+	git diff --cached | sed /^index/d >diff &&
 	test_cmp expected diff
 '
 
@@ -317,7 +310,7 @@ test_expect_success 'split hunk "add -p (edit)"' '
 	#    exits.
 	printf "%s\n" s e     q n q q |
 	EDITOR=: git add -p &&
-	git diff >actual &&
+	git diff | sed /^index/d >actual &&
 	! grep "^+15" actual
 '
 
@@ -329,7 +322,7 @@ test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
 	printf "%s\n" s n y e   q n q q |
 	EDITOR=: git add -p 2>error &&
 	test_must_be_empty error &&
-	git diff >actual &&
+	git diff | sed /^index/d >actual &&
 	! grep "^+31" actual
 '
 
@@ -348,14 +341,13 @@ test_expect_success 'patch mode ignores unmerged entries' '
 	cat >expected <<-\EOF &&
 	* Unmerged path conflict.t
 	diff --git a/non-conflict.t b/non-conflict.t
-	index f766221..5ea2ed4 100644
 	--- a/non-conflict.t
 	+++ b/non-conflict.t
 	@@ -1 +1 @@
 	-non-conflict
 	+changed
 	EOF
-	git diff --cached >diff &&
+	git diff --cached | sed /^index/d >diff &&
 	test_cmp expected diff
 '
 
-- 
2.16.1


  parent reply	other threads:[~2018-02-19 11:29 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 10:44 [PATCH 0/4] Correct offsets of hunks when one is skipped Phillip Wood
2018-02-13 10:44 ` [PATCH 1/4] add -i: add function to format hunk header Phillip Wood
2018-02-13 10:44 ` [PATCH 2/4] t3701: add failing test for pathological context lines Phillip Wood
2018-02-13 20:35   ` Junio C Hamano
2018-02-13 10:44 ` [PATCH 3/4] add -p: Adjust offsets of subsequent hunks when one is skipped Phillip Wood
2018-02-13 10:44 ` [PATCH 4/4] add -p: calculate offset delta for edited patches Phillip Wood
2018-02-13 23:56 ` [PATCH 0/4] Correct offsets of hunks when one is skipped brian m. carlson
2018-02-19 13:01   ` Phillip Wood
2018-02-19 11:29 ` [PATCH v2 0/9] " Phillip Wood
2018-02-19 11:29   ` [PATCH v2 1/9] add -i: add function to format hunk header Phillip Wood
2018-02-20 18:21     ` Junio C Hamano
2018-02-19 11:29   ` [PATCH v2 2/9] t3701: indent here documents Phillip Wood
2018-02-19 18:36     ` Eric Sunshine
2018-02-19 11:29   ` [PATCH v2 3/9] t3701: use test_write_lines and write_script Phillip Wood
2018-02-19 18:47     ` Eric Sunshine
2018-02-20 17:19       ` Junio C Hamano
2018-02-21 11:26         ` Phillip Wood
2018-02-19 11:29   ` Phillip Wood [this message]
2018-02-19 18:52     ` [PATCH v2 4/9] t3701: don't hard code sha1 hash values Eric Sunshine
2018-02-20 17:39     ` Junio C Hamano
2018-02-21 11:42       ` Phillip Wood
2018-02-21 16:58         ` Junio C Hamano
2018-02-19 11:29   ` [PATCH v2 5/9] t3701: add failing test for pathological context lines Phillip Wood
2018-02-21 11:28     ` Phillip Wood
2018-02-19 11:29   ` [PATCH v2 6/9] add -p: Adjust offsets of subsequent hunks when one is skipped Phillip Wood
2018-02-19 11:29   ` [PATCH v2 7/9] add -p: calculate offset delta for edited patches Phillip Wood
2018-02-19 11:29   ` [PATCH v2 8/9] add -p: fix counting when splitting and coalescing Phillip Wood
2018-02-19 11:29   ` [PATCH v2 9/9] add -p: don't rely on apply's '--recount' option Phillip Wood
2018-02-20 18:50     ` Junio C Hamano
2018-02-27 11:03 ` [PATCH v3 0/9] Correct offsets of hunks when one is skipped Phillip Wood
2018-02-27 11:03   ` [PATCH v3 1/9] add -i: add function to format hunk header Phillip Wood
2018-02-27 11:03   ` [PATCH v3 2/9] t3701: indent here documents Phillip Wood
2018-02-27 22:35     ` Junio C Hamano
2018-02-28 11:00       ` Phillip Wood
2018-02-28 15:37         ` Junio C Hamano
2018-03-01 10:57           ` Phillip Wood
2018-03-01 15:58             ` Junio C Hamano
2018-02-27 11:03   ` [PATCH v3 3/9] t3701: use test_write_lines and write_script Phillip Wood
2018-02-27 11:03   ` [PATCH v3 4/9] t3701: don't hard code sha1 hash values Phillip Wood
2018-02-27 22:42     ` Junio C Hamano
2018-02-28 11:03       ` Phillip Wood
2018-02-28 11:10         ` Phillip Wood
2018-02-27 11:04   ` [PATCH v3 5/9] t3701: add failing test for pathological context lines Phillip Wood
2018-02-27 11:04   ` [PATCH v3 6/9] add -p: Adjust offsets of subsequent hunks when one is skipped Phillip Wood
2018-02-27 11:04   ` [PATCH v3 7/9] add -p: calculate offset delta for edited patches Phillip Wood
2018-02-27 11:04   ` [PATCH v3 8/9] add -p: fix counting when splitting and coalescing Phillip Wood
2018-02-27 11:04   ` [PATCH v3 9/9] add -p: don't rely on apply's '--recount' option Phillip Wood
2018-03-01 10:50 ` [PATCH v4 0/9] Correct offsets of hunks when one is skipped Phillip Wood
2018-03-01 10:50   ` [PATCH v4 1/9] add -i: add function to format hunk header Phillip Wood
2018-03-01 10:50   ` [PATCH v4 2/9] t3701: indent here documents Phillip Wood
2018-03-01 10:50   ` [PATCH v4 3/9] t3701: use test_write_lines and write_script Phillip Wood
2018-03-01 10:50   ` [PATCH v4 4/9] t3701: don't hard code sha1 hash values Phillip Wood
2018-03-02 15:55     ` SZEDER Gábor
2018-03-02 16:09       ` Junio C Hamano
2018-03-05 10:59         ` Phillip Wood
2018-03-05 12:32           ` SZEDER Gábor
2018-03-01 10:50   ` [PATCH v4 5/9] t3701: add failing test for pathological context lines Phillip Wood
2018-03-01 10:51   ` [PATCH v4 6/9] add -p: adjust offsets of subsequent hunks when one is skipped Phillip Wood
2018-03-01 10:51   ` [PATCH v4 7/9] add -p: calculate offset delta for edited patches Phillip Wood
2018-03-01 20:14     ` Junio C Hamano
2018-03-02 10:36       ` Phillip Wood
2018-03-01 10:51   ` [PATCH v4 8/9] add -p: fix counting when splitting and coalescing Phillip Wood
2018-03-01 20:29     ` Junio C Hamano
2018-03-02 10:48       ` Phillip Wood
2018-03-01 10:51   ` [PATCH v4 9/9] add -p: don't rely on apply's '--recount' option Phillip Wood
2018-03-01 20:30     ` Junio C Hamano
2018-03-02 10:49       ` Phillip Wood
2018-03-05 10:56 ` [PATCH v5 0/9] Correct offsets of hunks when one is skipped Phillip Wood
2018-03-05 10:56   ` [PATCH v5 1/9] add -i: add function to format hunk header Phillip Wood
2018-03-05 10:56   ` [PATCH v5 2/9] t3701: indent here documents Phillip Wood
2018-03-05 10:56   ` [PATCH v5 3/9] t3701: use test_write_lines and write_script Phillip Wood
2018-03-05 10:56   ` [PATCH v5 4/9] t3701: don't hard code sha1 hash values Phillip Wood
2018-03-05 10:56   ` [PATCH v5 5/9] t3701: add failing test for pathological context lines Phillip Wood
2018-03-05 10:56   ` [PATCH v5 6/9] add -p: adjust offsets of subsequent hunks when one is skipped Phillip Wood
2018-03-05 10:56   ` [PATCH v5 7/9] add -p: calculate offset delta for edited patches Phillip Wood
2018-03-05 10:56   ` [PATCH v5 8/9] add -p: fix counting when splitting and coalescing Phillip Wood
2018-03-05 10:56   ` [PATCH v5 9/9] add -p: don't rely on apply's '--recount' option Phillip Wood
2018-03-05 18:50   ` [PATCH v5 0/9] Correct offsets of hunks when one is skipped Junio C Hamano
2018-03-06 10:25     ` Phillip Wood

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=20180219112910.24471-5-phillip.wood@talktalk.net \
    --to=phillip.wood@talktalk.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sandals@crustytoothpaste.net \
    /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).