git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Chris Torek <chris.torek@gmail.com>
Subject: [PATCH v2 0/2] t: don't spuriously close and reopen quotes
Date: Thu,  6 Aug 2020 22:08:52 +0200	[thread overview]
Message-ID: <cover.1596742823.git.martin.agren@gmail.com> (raw)
In-Reply-To: <20200802143018.5501-1-martin.agren@gmail.com>

This is an updated version of the patch I posted inline in [1]. I've
tweaked the end result a bit and pulled out the modifications to t4104
to their own patch. t4104 is also where most of the interdiff is spent.

I've updated the commit message of the main patch based on the
discussion in the earlier thread.

[1] https://lore.kernel.org/git/20200802143018.5501-1-martin.agren@gmail.com/

Martin Ågren (2):
  t: don't spuriously close and reopen quotes
  t4104: modernize and simplify quoting

 t/t1400-update-ref.sh           |  2 +-
 t/t3501-revert-cherry-pick.sh   |  4 +--
 t/t3507-cherry-pick-conflict.sh |  4 +--
 t/t4005-diff-rename-2.sh        |  4 +--
 t/t4034-diff-words.sh           |  2 +-
 t/t4104-apply-boundary.sh       | 57 +++++++++------------------------
 t/t4150-am.sh                   |  8 ++---
 t/t4200-rerere.sh               |  2 +-
 t/t5302-pack-index.sh           |  2 +-
 t/t5510-fetch.sh                |  4 +--
 t/t5553-set-upstream.sh         |  6 ++--
 t/t6026-merge-attr.sh           |  4 +--
 t/t7001-mv.sh                   |  2 +-
 t/t7600-merge.sh                |  6 ++--
 t/t9001-send-email.sh           | 10 +++---
 t/t9100-git-svn-basic.sh        |  6 ++--
 t/t9401-git-cvsserver-crlf.sh   |  8 ++---
 t/t9402-git-cvsserver-refs.sh   |  2 +-
 18 files changed, 53 insertions(+), 80 deletions(-)

Interdiff against v1:
diff --git a/t/t4104-apply-boundary.sh b/t/t4104-apply-boundary.sh
index 19f08d9ccd..71ef4132d1 100755
--- a/t/t4104-apply-boundary.sh
+++ b/t/t4104-apply-boundary.sh
@@ -3,80 +3,55 @@
 # Copyright (c) 2005 Junio C Hamano
 #
 
-test_description='git apply boundary tests
+test_description='git apply boundary tests'
 
-'
 . ./test-lib.sh
 
 L="c d e f g h i j k l m n o p q r s t u v w x"
 
 test_expect_success setup '
-	for i in b $L y
-	do
-		echo $i
-	done >victim &&
+	test_write_lines b $L y >victim &&
 	cat victim >original &&
 	git update-index --add victim &&
 
 	# add to the head
-	for i in a b $L y
-	do
-		echo $i
-	done >victim &&
+	test_write_lines a b $L y >victim &&
 	cat victim >add-a-expect &&
 	git diff victim >add-a-patch.with &&
 	git diff --unified=0 >add-a-patch.without &&
 
 	# insert at line two
-	for i in b a $L y
-	do
-		echo $i
-	done >victim &&
+	test_write_lines b a $L y >victim &&
 	cat victim >insert-a-expect &&
 	git diff victim >insert-a-patch.with &&
 	git diff --unified=0 >insert-a-patch.without &&
 
 	# modify at the head
-	for i in a $L y
-	do
-		echo $i
-	done >victim &&
+	test_write_lines a $L y >victim &&
 	cat victim >mod-a-expect &&
 	git diff victim >mod-a-patch.with &&
 	git diff --unified=0 >mod-a-patch.without &&
 
 	# remove from the head
-	for i in $L y
-	do
-		echo $i
-	done >victim &&
+	test_write_lines $L y >victim &&
 	cat victim >del-a-expect &&
 	git diff victim >del-a-patch.with &&
 	git diff --unified=0 >del-a-patch.without &&
 
 	# add to the tail
-	for i in b $L y z
-	do
-		echo $i
-	done >victim &&
+	test_write_lines b $L y z >victim &&
 	cat victim >add-z-expect &&
 	git diff victim >add-z-patch.with &&
 	git diff --unified=0 >add-z-patch.without &&
 
 	# modify at the tail
-	for i in b $L z
-	do
-		echo $i
-	done >victim &&
+	test_write_lines b $L z >victim &&
 	cat victim >mod-z-expect &&
 	git diff victim >mod-z-patch.with &&
 	git diff --unified=0 >mod-z-patch.without &&
 
 	# remove from the tail
-	for i in b $L
-	do
-		echo $i
-	done >victim &&
+	test_write_lines b $L >victim &&
 	cat victim >del-z-expect &&
 	git diff victim >del-z-patch.with &&
 	git diff --unified=0 >del-z-patch.without
@@ -88,15 +63,15 @@ for with in with without
 do
 	case "$with" in
 	with) u= ;;
-	without) u='--unidiff-zero ' ;;
+	without) u=--unidiff-zero ;;
 	esac
 	for kind in add-a add-z insert-a mod-a mod-z del-a del-z
 	do
 		test_expect_success "apply $kind-patch $with context" '
 			cat original >victim &&
 			git update-index victim &&
-			git apply --index $u$kind-patch.$with &&
-			test_cmp $kind-expect victim
+			git apply --index $u "$kind-patch.$with" &&
+			test_cmp "$kind-expect" victim
 		'
 	done
 done
@@ -110,13 +85,12 @@ do
 	test_expect_success "apply non-git $kind-patch without context" '
 		cat original >victim &&
 		git update-index victim &&
-		git apply --unidiff-zero --index $kind-ng.without &&
-		test_cmp $kind-expect victim
+		git apply --unidiff-zero --index "$kind-ng.without" &&
+		test_cmp "$kind-expect" victim
 	'
 done
 
 test_expect_success 'two lines' '
-
 	>file &&
 	git add file &&
 	echo aaa >file &&
@@ -125,11 +99,10 @@ test_expect_success 'two lines' '
 	echo bbb >file &&
 	git add file &&
 	test_must_fail git apply --check patch
-
 '
 
 test_expect_success 'apply patch with 3 context lines matching at end' '
-	{ echo a; echo b; echo c; echo d; } >file &&
+	test_write_lines a b c d >file &&
 	git add file &&
 	echo e >>file &&
 	git diff >patch &&
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 1f9d13819f..e9c575c359 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -63,7 +63,7 @@ test_expect_success "$name" '
 
 
 name='detect node change from file to directory #1'
-test_expect_success "$name" "
+test_expect_success "$name" '
 	mkdir dir/new_file &&
 	mv dir/file dir/new_file/file &&
 	mv dir/new_file dir/file &&
@@ -72,7 +72,7 @@ test_expect_success "$name" "
 	git commit -m "$name" &&
 	test_must_fail git svn set-tree --find-copies-harder --rmdir \
 		remotes/git-svn..mybranch
-"
+'
 
 
 name='detect node change from directory to file #1'
-- 
2.28.0.199.g4234a9100e


  parent reply	other threads:[~2020-08-06 20:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-01 22:06 [PATCH] t1450: fix quoting of NUL byte when corrupting pack Martin Ågren
2020-08-02  0:45 ` Junio C Hamano
2020-08-02 14:30   ` Martin Ågren
2020-08-02 17:22     ` Eric Sunshine
2020-08-06 20:08     ` Martin Ågren [this message]
2020-08-06 20:08       ` [PATCH v2 1/2] t: don't spuriously close and reopen quotes Martin Ågren
2020-08-06 20:26         ` Eric Sunshine
2020-08-07  8:45           ` Martin Ågren
2020-08-07 16:17             ` Eric Sunshine
2020-08-07 17:16               ` Junio C Hamano
2020-08-06 20:08       ` [PATCH v2 2/2] t4104: modernize and simplify quoting Martin Ågren
2020-08-02  1:00 ` [PATCH] t1450: fix quoting of NUL byte when corrupting pack Chris Torek
2020-08-02  1:02   ` Chris Torek
2020-08-02 14:35     ` Martin Ågren
2020-08-02 16:20       ` Chris Torek
2020-08-02 17:57         ` 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

  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=cover.1596742823.git.martin.agren@gmail.com \
    --to=martin.agren@gmail.com \
    --cc=chris.torek@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.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).