[PATCH v2 3/4] Add tests for coverauto, coverletter and --cover-letter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Very much based on Jeff King's suggestion from
<20090421033213.GA14881@xxxxxxxxxxxxxxxxxxxxxxx>

This change also makes sure that one major user of --stdout
(git-rebase.sh) works with format.coverauto set to true.

Signed-off-by: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
---
 t/t3400-rebase.sh       |    1 +
 t/t4014-format-patch.sh |   58 +++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 6e391a3..48d8360 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -15,6 +15,7 @@ export GIT_AUTHOR_EMAIL
 test_expect_success \
     'prepare repository with topic branches' \
     'git config core.logAllRefUpdates true &&
+     git config format.coverauto true &&
      echo First > A &&
      git update-index --add A &&
      git commit -m "Add A." &&
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 11061dd..3f431ff 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -151,6 +151,60 @@ test_expect_success 'multiple files' '
 	ls patches/0001-Side-changes-1.patch patches/0002-Side-changes-2.patch patches/0003-Side-changes-3-with-n-backslash-n-in-it.patch
 '
 
+test_expect_success '--cover-letter generates cover letter' '
+
+	rm -rf patches &&
+	git config format.coverletter 1
+	git format-patch --cover-letter -o patches/ master &&
+	test -f patches/0000-cover-letter.patch
+'
+
+test_expect_success 'format.coverletter=number > 1 generates cover letter' '
+
+	rm -rf patches &&
+	git config format.coverletter 3 &&
+	git format-patch --cover-letter -o patches/ master &&
+	test -f patches/0000-cover-letter.patch
+'
+
+test_expect_success 'format.coverletter respects minimum patchset size' '
+
+	rm -rf patches &&
+	git config format.coverletter 4 &&
+	git format-patch --cover-letter -o patches/ master &&
+	! test -f patches/0000-cover-letter.patch
+'
+
+test_expect_success '--cover-letter=never disables cover letters' '
+
+	rm -rf patches &&
+	git config format.coverletter 2 &&
+	git format-patch --cover-letter=never -o patches/ master &&
+	! test -f patches/0000-cover-letter.patch
+'
+
+test_expect_success '--cover-letter=always forces cover letters' '
+
+	rm -rf patches &&
+	git format-patch --cover-letter=always -o patches/ master &&
+	test -f patches/0000-cover-letter.patch
+'
+
+test_expect_success 'format.coverauto works (1)' '
+
+	rm -rf patches &&
+	git config format.coverauto true &&
+	git format-patch -1 -o patches/ master &&
+	! test -f patches/0000-cover-letter.patch
+'
+
+test_expect_success 'format.coverauto works (2)' '
+
+	rm -rf patches &&
+	git format-patch -2 -o patches/ master &&
+	test -f patches/0000-cover-letter.patch
+'
+
 check_threading () {
 	expect="$1" &&
 	shift &&
@@ -405,9 +459,9 @@ test_expect_success 'cover-letter inherits diff options' '
 
 	git mv file foo &&
 	git commit -m foo &&
-	git format-patch --cover-letter -1 &&
+	git format-patch --cover-letter=always -1 &&
 	! grep "file => foo .* 0 *$" 0000-cover-letter.patch &&
-	git format-patch --cover-letter -1 -M &&
+	git format-patch --cover-letter=always -1 -M &&
 	grep "file => foo .* 0 *$" 0000-cover-letter.patch
 
 '
-- 
1.6.2.2.446.gfbdc0

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]