All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Han-Wen Nienhuys" <hanwen@google.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2 2/5] tests: stop using top-level "README" and "COPYING" files
Date: Tue,  5 Oct 2021 19:01:14 +0200	[thread overview]
Message-ID: <patch-v2-2.5-f7cd2f31ccb-20211005T170031Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-v2-0.5-00000000000-20211005T170031Z-avarab@gmail.com>

In 459b8d22e54 (tests: do not borrow from COPYING and README from the
real source, 2015-02-15) tests that used "lib-diff.sh" (called
"diff-lib.sh" then) were made to stop relying on the top-level COPYING
file, but we still had other tests that referenced it.

Let's move them over to use the "COPYING_test_data" utility function
introduced in the preceding commit, and in the case of the one test
that needed the "README" file use a ROT 13 version of that "COPYING"
test data. That test added in afd222967c6 (Extend testing git-mv for
renaming of subdirectories, 2006-07-26) just needs more test data that's not the same as the "COPYING" test data, so a ROT 13 version will do.

This change removes the last references to ../{README,COPYING} in the
test suite.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t4022-diff-rewrite.sh           |  6 ++++--
 t/t4023-diff-rename-typechange.sh | 11 ++++++-----
 t/t7001-mv.sh                     |  5 +++--
 t/t7101-reset-empty-subdirs.sh    | 11 ++++++-----
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh
index 6d1c3d949c7..1c89050a974 100755
--- a/t/t4022-diff-rewrite.sh
+++ b/t/t4022-diff-rewrite.sh
@@ -3,15 +3,17 @@
 test_description='rewrite diff'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success setup '
 
-	cat "$TEST_DIRECTORY"/../COPYING >test &&
+	COPYING_test_data >test.data &&
+	cp test.data test &&
 	git add test &&
 	tr \
 	  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
 	  "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \
-	  <"$TEST_DIRECTORY"/../COPYING >test &&
+	  <test.data >test &&
 	echo "to be deleted" >test2 &&
 	blob=$(git hash-object test2) &&
 	blob=$(git rev-parse --short $blob) &&
diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
index 8c9823765e6..47d6f35dcc4 100755
--- a/t/t4023-diff-rename-typechange.sh
+++ b/t/t4023-diff-rename-typechange.sh
@@ -3,25 +3,26 @@
 test_description='typechange rename detection'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff.sh
 
 test_expect_success setup '
 
 	rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	test_ln_s_add linklink bar &&
 	git add foo &&
 	git commit -a -m Initial &&
 	git tag one &&
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >bar &&
+	COPYING_test_data >bar &&
 	test_ln_s_add linklink foo &&
 	git add bar &&
 	git commit -a -m Second &&
 	git tag two &&
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	git add foo &&
 	git commit -a -m Third &&
 	git tag three &&
@@ -35,7 +36,7 @@ test_expect_success setup '
 	# This is purely for sanity check
 
 	git rm -f foo bar &&
-	cat "$TEST_DIRECTORY"/../COPYING >foo &&
+	COPYING_test_data >foo &&
 	cat "$TEST_DIRECTORY"/../Makefile >bar &&
 	git add foo bar &&
 	git commit -a -m Fifth &&
@@ -43,7 +44,7 @@ test_expect_success setup '
 
 	git rm -f foo bar &&
 	cat "$TEST_DIRECTORY"/../Makefile >foo &&
-	cat "$TEST_DIRECTORY"/../COPYING >bar &&
+	COPYING_test_data >bar &&
 	git add foo bar &&
 	git commit -a -m Sixth &&
 	git tag six
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 25bb9bbb899..963356ba5f9 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -2,10 +2,11 @@
 
 test_description='git mv in subdirs'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success 'prepare reference tree' '
 	mkdir path0 path1 &&
-	cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+	COPYING_test_data >path0/COPYING &&
 	git add path0/COPYING &&
 	git commit -m add -a
 '
@@ -107,7 +108,7 @@ test_expect_success 'clean up' '
 '
 
 test_expect_success 'adding another file' '
-	cp "$TEST_DIRECTORY"/../README.md path0/README &&
+	COPYING_test_data | tr A-Za-z N-ZA-Mn-za-m >path0/README &&
 	git add path0/README &&
 	git commit -m add2 -a
 '
diff --git a/t/t7101-reset-empty-subdirs.sh b/t/t7101-reset-empty-subdirs.sh
index bfce05ac5de..5530651eea4 100755
--- a/t/t7101-reset-empty-subdirs.sh
+++ b/t/t7101-reset-empty-subdirs.sh
@@ -5,10 +5,11 @@
 
 test_description='git reset should cull empty subdirs'
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-diff-data.sh
 
 test_expect_success 'creating initial files' '
      mkdir path0 &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
+     COPYING_test_data >path0/COPYING &&
      git add path0/COPYING &&
      git commit -m add -a
 '
@@ -16,10 +17,10 @@ test_expect_success 'creating initial files' '
 test_expect_success 'creating second files' '
      mkdir path1 &&
      mkdir path1/path2 &&
-     cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING path1/COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING COPYING &&
-     cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO &&
+     COPYING_test_data >path1/path2/COPYING &&
+     COPYING_test_data >path1/COPYING &&
+     COPYING_test_data >COPYING &&
+     COPYING_test_data >path0/COPYING-TOO &&
      git add path1/path2/COPYING &&
      git add path1/COPYING &&
      git add COPYING &&
-- 
2.33.0.1441.gbbcdb4c3c66


  parent reply	other threads:[~2021-10-05 17:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02  9:19 [PATCH 0/5] COPYING: modernize, steal boilerplate from linux.git Ævar Arnfjörð Bjarmason
2021-10-02  9:19 ` [PATCH 1/5] "lib-diff" tests: make "README" and "COPYING" test data smaller Ævar Arnfjörð Bjarmason
2021-10-04 16:46   ` Han-Wen Nienhuys
2021-10-04 17:59     ` Ævar Arnfjörð Bjarmason
2021-10-02  9:19 ` [PATCH 2/5] tests: stop using top-level "README" and "COPYING" files Ævar Arnfjörð Bjarmason
2021-10-02  9:19 ` [PATCH 3/5] COPYING: remove mention of GPLv3, clarify sub-project COPYING Ævar Arnfjörð Bjarmason
2021-10-04  6:21   ` Junio C Hamano
2021-10-02  9:19 ` [PATCH 4/5] COPYING: move GPL text to a "GPL-2.0" file Ævar Arnfjörð Bjarmason
2021-10-02  9:19 ` [PATCH 5/5] GPL-2.0: update to byte-for-byte match the FSF's version Ævar Arnfjörð Bjarmason
2021-10-04 17:28 ` [PATCH 0/5] COPYING: modernize, steal boilerplate from linux.git Han-Wen Nienhuys
2021-10-05 17:01 ` [PATCH v2 " Ævar Arnfjörð Bjarmason
2021-10-05 17:01   ` [PATCH v2 1/5] "lib-diff" tests: make "README" and "COPYING" test data smaller Ævar Arnfjörð Bjarmason
2021-10-05 17:01   ` Ævar Arnfjörð Bjarmason [this message]
2021-10-05 17:01   ` [PATCH v2 3/5] COPYING: remove mention of GPLv3, clarify sub-project COPYING Ævar Arnfjörð Bjarmason
2021-10-05 17:01   ` [PATCH v2 4/5] COPYING: move GPL text to a "GPL-2.0" file Ævar Arnfjörð Bjarmason
2021-10-05 17:01   ` [PATCH v2 5/5] GPL-2.0: update to byte-for-byte match the FSF's version Ævar Arnfjörð Bjarmason
2021-10-15  9:30   ` [PATCH v3 0/2] tests: stop relying on top-level COPYING and README Ævar Arnfjörð Bjarmason
2021-10-15  9:30     ` [PATCH v3 1/2] "lib-diff" tests: make "README" and "COPYING" test data smaller Ævar Arnfjörð Bjarmason
2021-10-15 16:36       ` Junio C Hamano
2021-10-15  9:30     ` [PATCH v3 2/2] tests: stop using top-level "README" and "COPYING" files Ævar Arnfjörð Bjarmason

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=patch-v2-2.5-f7cd2f31ccb-20211005T170031Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hanwen@google.com \
    --cc=mchehab@kernel.org \
    --cc=peff@peff.net \
    --cc=torvalds@linux-foundation.org \
    /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.