git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v10 4/5] t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18n.commitEncoding is not set

From
Alexey Shumkin <alex.crezoff@gmail.com>
Date
Jul 5, 2013, 12:01 UTC
Message-ID
<a17c23d117e9457cdf131068a4aae586bda854e8.1373024281.git.Alex.Crezoff@gmail.com>
In-Reply-To
<cover.1373024281.git.Alex.Crezoff@gmail.com>

In de6029a (pretty: Add failing tests: --format output should honor logOutputEncoding, 2013-06-26) 'complex-subject' test was changed. Revert it back, because that change actually removed tests for "%b" and "%s" with i18n.commitEncoding set. Also, add two more tests for mentioned above "%b" and "%s" to test encoding conversions with no i18n.commitEncoding set.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Suggested-by: Johannes Sixt <j.sixt@viscovery.net>
---
 t/t6006-rev-list-format.sh | 41 ++++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index b32405a..e51d0f0 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -218,12 +218,7 @@ test_expect_success 'setup complex body' '
 	git config i18n.commitencoding iso8859-1 &&
 	echo change2 >foo && git commit -a -F commit-msg &&
 	head3=$(git rev-parse --verify HEAD) &&
-	head3_short=$(git rev-parse --short $head3) &&
-	# unset commit encoding config
-	# otherwise %e does not print encoding value
-	# and following test fails
-	git config --unset i18n.commitEncoding
-
+	head3_short=$(git rev-parse --short $head3)
 '
 
 test_format complex-encoding %e <<EOF
@@ -239,21 +234,41 @@ test_format complex-subject %s <<EOF
 commit $head3
 Test printing of complex bodies
 commit $head2
-$changed
+$changed_iso88591
 commit $head1
-$added
+$added_iso88591
 EOF
 
-test_format complex-body %b <<EOF
-commit $head3
-This commit message is much longer than the others,
-and it will be encoded in iso8859-1. We should therefore
-include an iso8859 character: ¡bueno!
+test_expect_success 'prepare expected messages (for test %b)' '
+    cat <<-EOF >expected.utf-8 &&
+	commit $head3
+	This commit message is much longer than the others,
+	and it will be encoded in iso8859-1. We should therefore
+	include an iso8859 character: ¡bueno!
+
+	commit $head2
+	commit $head1
+EOF
+	iconv -f utf-8 -t iso8859-1 expected.utf-8 >expected.iso8859-1
+'
+
+test_format complex-body %b <expected.iso8859-1
 
+# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set
+# so unset i18n.commitEncoding to test encoding conversion
+git config --unset i18n.commitEncoding
+
+test_format complex-subject-commitencoding-unset %s <<EOF
+commit $head3
+Test printing of complex bodies
 commit $head2
+$changed
 commit $head1
+$added
 EOF
 
+test_format complex-body-commitencoding-unset %b <expected.utf-8
+
 test_expect_success '%x00 shows NUL' '
 	echo  >expect commit $head3 &&
 	echo >>expect fooQbar &&
-- 
1.8.3.2.16.gb1f0d63
Previous: Junio C HamanoNext: Alexey Shumkin
Message 7 of 8 in “Incremental updates against 'next' branch”
  1. 0/5 Incremental updates against 'next' branchAlexey Shumkin, Jul 5, 2013
  2. 1/5 t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1Alexey Shumkin, Jul 5, 2013
  3. 2/5 t4205 (log-pretty-formats): revert back single quotesAlexey Shumkin, Jul 5, 2013
  4. 3/5 t4205, t6006, t7102: make functions better readableAlexey Shumkin, Jul 5, 2013
  5. Junio C HamanoJul 5, 2013
  6. Junio C HamanoJul 5, 2013
  7. 4/5 t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18n.commitEncoding is not setAlexey Shumkin, Jul 5, 2013
  8. 5/5 t4205 (log-pretty-formats): avoid using `sed`Alexey Shumkin, Jul 5, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.