{"thread":{"id":"28440","subject":"[PATCH v3 2/2] pretty: user format ignores i18n.logOutputEncoding setting","startedAt":"2011-09-20T08:21:31Z","lastAt":"2013-07-05T08:58:07Z","messageCount":82,"participants":["Alexey Shumkin","Junio C Hamano","Johannes Sixt"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"175843","messageId":"1316506892-6072-1-git-send-email-zapped@mail.ru","threadId":"28440","inReplyTo":"7v1uvptjhr.fsf@alter.siamese.dyndns.org","subject":"[PATCH v3 1/2] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"zapped@mail.ru","sentAt":"2011-09-20T08:21:31Z","receivedAt":"2011-09-20T08:21:31Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The following two commands are expected to give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it format \"%s\".\nLog messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted with the latter even\nwhen i18n.logOutputEncoding and terminal encoding are the same.\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\n\nSigned-off-by: Alexey Shumkin <zapped@mail.ru>\n---\n t/t4041-diff-submodule-option.sh |   56 ++++++------\n t/t4205-log-pretty-formats.sh    |   22 ++++-\n t/t6006-rev-list-format.sh       |  192 +++++++++++++++++++++++---------------\n 3 files changed, 164 insertions(+), 106 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex bf9a752..b0cec5e 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -1,6 +1,7 @@\n #!/bin/sh\n #\n # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Support for verbose submodule differences in git diff\n@@ -10,6 +11,7 @@ This test tries to verify the sanity of the --submodule option of git diff.\n \n . ./test-lib.sh\n \n+added=$(printf \"\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275\")\n add_file () {\n \tsm=$1\n \tshift\n@@ -19,8 +21,11 @@ add_file () {\n \t\techo \"$name\" > \"$name\" &&\n \t\tgit add \"$name\" &&\n \t\ttest_tick &&\n-\t\tgit commit -m \"Add $name\"\n+\t\tmsg_added_cp1251=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t cp1251) && \n+\t\tgit config i18n.commitEncoding cp1251 &&\n+\t\tgit commit -m \"$msg_added_cp1251\"\n \tdone >/dev/null\n+\tgit config --unset i18n.commitEncoding\n \tgit rev-parse --verify HEAD | cut -c1-7\n \tcd \"$owd\"\n }\n@@ -48,28 +53,25 @@ head2=$(add_file sm1 foo3)\n \n test_expect_success 'modified submodule(forward)' \"\n \tgit diff-index -p --submodule=log HEAD >actual &&\n-\tcat >expected <<-EOF &&\n-Submodule sm1 $head1..$head2:\n-  > Add foo3\n-EOF\n+\tprintf \\\"Submodule sm1 $head1..$head2:\\n\\\n+  > Add foo3 ($added foo3)\\n\\\n+\\\" > expected &&\n \ttest_cmp expected actual\n \"\n \n test_expect_success 'modified submodule(forward)' \"\n \tgit diff --submodule=log >actual &&\n-\tcat >expected <<-EOF &&\n-Submodule sm1 $head1..$head2:\n-  > Add foo3\n-EOF\n+\tprintf \\\"Submodule sm1 $head1..$head2:\\n\\\n+  > Add foo3 ($added foo3)\\n\\\n+\\\" > expected &&\n \ttest_cmp expected actual\n \"\n \n test_expect_success 'modified submodule(forward) --submodule' \"\n \tgit diff --submodule >actual &&\n-\tcat >expected <<-EOF &&\n-Submodule sm1 $head1..$head2:\n-  > Add foo3\n-EOF\n+\tprintf \\\"Submodule sm1 $head1..$head2:\\n\\\n+  > Add foo3 ($added foo3)\\n\\\n+\\\" > expected &&\n \ttest_cmp expected actual\n \"\n \n@@ -98,11 +100,10 @@ head3=$(\n \n test_expect_success 'modified submodule(backward)' \"\n \tgit diff-index -p --submodule=log HEAD >actual &&\n-\tcat >expected <<-EOF &&\n-Submodule sm1 $head2..$head3 (rewind):\n-  < Add foo3\n-  < Add foo2\n-EOF\n+\tprintf \\\"Submodule sm1 $head2..$head3 (rewind):\\n\\\n+  < Add foo3 ($added foo3)\\n\\\n+  < Add foo2 ($added foo2)\\n\\\n+\\\" > expected &&\n \ttest_cmp expected actual\n \"\n \n@@ -110,13 +111,12 @@ head4=$(add_file sm1 foo4 foo5) &&\n head4_full=$(GIT_DIR=sm1/.git git rev-parse --verify HEAD)\n test_expect_success 'modified submodule(backward and forward)' \"\n \tgit diff-index -p --submodule=log HEAD >actual &&\n-\tcat >expected <<-EOF &&\n-Submodule sm1 $head2...$head4:\n-  > Add foo5\n-  > Add foo4\n-  < Add foo3\n-  < Add foo2\n-EOF\n+\tprintf \\\"Submodule sm1 $head2...$head4:\\n\\\n+  > Add foo5 ($added foo5)\\n\\\n+  > Add foo4 ($added foo4)\\n\\\n+  < Add foo3 ($added foo3)\\n\\\n+  < Add foo2 ($added foo2)\\n\\\n+\\\" > expected &&\n \ttest_cmp expected actual\n \"\n \n@@ -131,10 +131,10 @@ mv sm1-bak sm1\n test_expect_success 'typechanged submodule(submodule->blob), --cached' \"\n \tgit diff --submodule=log --cached >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 41fbea9...0000000 (submodule deleted)\n+Submodule sm1 $head4...0000000 (submodule deleted)\n diff --git a/sm1 b/sm1\n new file mode 100644\n-index 0000000..9da5fb8\n+index 0000000..$head5\n --- /dev/null\n +++ b/sm1\n @@ -0,0 +1 @@\n@@ -148,7 +148,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' \"\n \tcat >expected <<-EOF &&\n diff --git a/sm1 b/sm1\n deleted file mode 100644\n-index 9da5fb8..0000000\n+index $head5..0000000\n --- a/sm1\n +++ /dev/null\n @@ -1 +0,0 @@\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 2ae9faa..9da6835 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -1,6 +1,7 @@\n #!/bin/sh\n #\n # Copyright (c) 2010, Will Palmer\n+# Copyright (c) 2011, Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Test pretty formats'\n@@ -11,10 +12,13 @@ test_expect_success 'set up basic repos' '\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit commit -m initial &&\n+\tgit config i18n.commitEncoding cp1251 &&\n+\tmsg_commit_cp1251=$(printf \"initial \\320\\272\\320\\276\\320\\274\\320\\274\\320\\270\\321\\202\" | iconv -f utf-8 -t cp1251) &&\n+\tgit commit -m \"$msg_commit_cp1251\" &&\n \tgit add bar &&\n \ttest_tick &&\n-\tgit commit -m \"add bar\"\n+\tgit commit -m \"add bar\" &&\n+\tgit config --unset i18n.commitEncoding\n '\n \n test_expect_success 'alias builtin format' '\n@@ -38,6 +42,20 @@ test_expect_success 'alias user-defined format' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'alias user-defined tformat with %s (cp1251 encoding)' '\n+\tgit config i18n.logOutputEncoding cp1251 &&\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\tgit config --unset i18n.logOutputEncoding &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n+test_expect_success 'alias user-defined tformat with %s (utf-8 encoding)' '\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n test_expect_success 'alias user-defined tformat' '\n \tgit log --pretty=\"tformat:%h\" >expected &&\n \tgit config pretty.test-alias \"tformat:%h\" &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex d918cc0..8d99635 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -1,13 +1,34 @@\n #!/bin/sh\n \n+# Copyright (c) 2009 Jens Lehmann\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n+\n test_description='git rev-list --pretty=format test'\n \n . ./test-lib.sh\n \n test_tick\n+added=$(printf \"added (\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275) foo\")\n+added_cp1251=$(echo \"$added\" | iconv -f utf-8 -t cp1251)\n+changed=$(printf \"changed (\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275) foo\")\n+changed_cp1251=$(echo \"$changed\" | iconv -f utf-8 -t cp1251)\n+\n test_expect_success 'setup' '\n-touch foo && git add foo && git commit -m \"added foo\" &&\n-  echo changed >foo && git commit -a -m \"changed foo\"\n+\ttouch foo &&\n+\tgit add foo &&\n+\tgit config i18n.commitEncoding cp1251 &&\n+\tgit commit -m \"$added_cp1251\" &&\n+\thead1=$(git rev-parse --verify HEAD) &&\n+\thead1_7=$(echo $head1 | cut -c1-7) &&\n+\techo \"$changed\" > foo &&\n+\tgit commit -a -m \"$changed_cp1251\" &&\n+\thead2=$(git rev-parse --verify HEAD) &&\n+\thead2_7=$(echo $head2 | cut -c1-7) &&\n+\ttree2=$(git cat-file -p HEAD | grep tree | cut -f 2 -d\" \") &&\n+\ttree2_7=$(echo $tree2 | cut -c1-7) &&\n+\thead2_parent=$(git cat-file -p HEAD | grep parent | cut -f 2 -d\" \") &&\n+\thead2_parent_7=$(echo $head2_parent | cut -c1-7) &&\n+\tgit config --unset i18n.commitEncoding\n '\n \n # usage: test_format name format_string <expected_output\n@@ -19,49 +40,49 @@ test_cmp expect.$1 output.$1\n \"\n }\n \n-test_format percent %%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format percent %%h <<EOF\n+commit $head2\n %h\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n %h\n EOF\n \n-test_format hash %H%n%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-131a310eb913d107dd3c09a65d1651175898735d\n-131a310\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n+test_format hash %H%n%h <<EOF\n+commit $head2\n+$head2\n+$head2_7\n+commit $head1\n+$head1\n+$head1_7\n EOF\n \n-test_format tree %T%n%t <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-fe722612f26da5064c32ca3843aa154bdb0b08a0\n-fe72261\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format tree %T%n%t <<EOF\n+commit $head2\n+$tree2\n+$tree2_7\n+commit $head1\n 4d5fcadc293a348e88f777dc0920f11e7d71441c\n 4d5fcad\n EOF\n \n-test_format parents %P%n%p <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format parents %P%n%p <<EOF\n+commit $head2\n+$head1\n+$head2_parent_7\n+commit $head1\n \n \n EOF\n \n # we don't test relative here\n-test_format author %an%n%ae%n%ad%n%aD%n%at <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format author %an%n%ae%n%ad%n%aD%n%at <<EOF\n+commit $head2\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -69,14 +90,14 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<EOF\n+commit $head2\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -84,86 +105,105 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format encoding %e <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format encoding %e <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format subject %s <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-added foo\n+expected=$(printf \"commit $head2\\n\\\n+$changed\\n\\\n+commit $head1\\n\\\n+$added\n+\")\n+\n+test_format subject %s <<EOF\n+$expected\n EOF\n \n-test_format body %b <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format body %b <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format raw-body %B <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-changed foo\n+expected=$(printf \"commit $head2\\n\\\n+$changed\\n\\\n+\\n\\\n+commit $head1\\n\\\n+$added\n+\")\n \n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-added foo\n+test_format raw-body %B <<EOF\n+$expected\n \n EOF\n \n-test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<EOF\n+commit $head2\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n EOF\n \n-test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<EOF\n+commit $head2\n \u001b[1;31;43mfoo\u001b[m\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[1;31;43mfoo\u001b[m\n EOF\n \n-cat >commit-msg <<'EOF'\n+iconv -f utf-8 -t cp1251 > commit-msg <<EOF\n Test printing of complex bodies\n \n This commit message is much longer than the others,\n-and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: ¡bueno!\n+and it will be encoded in cp1251. We should therefore\n+include an cp1251 character: так вот!\n EOF\n+\n test_expect_success 'setup complex body' '\n-git config i18n.commitencoding iso8859-1 &&\n-  echo change2 >foo && git commit -a -F commit-msg\n+\tgit config i18n.commitencoding cp1251 &&\n+\techo change2 >foo && git commit -a -F commit-msg &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n+\thead3_7=$(echo $head3 | cut -c1-7)\n '\n \n-test_format complex-encoding %e <<'EOF'\n-commit f58db70b055c5718631e5c61528b28b12090cdea\n-iso8859-1\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format complex-encoding %e <<EOF\n+commit $head3\n+cp1251\n+commit $head2\n+cp1251\n+commit $head1\n+cp1251\n EOF\n \n-test_format complex-subject %s <<'EOF'\n-commit f58db70b055c5718631e5c61528b28b12090cdea\n-Test printing of complex bodies\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-added foo\n+# unset commit encoding config\n+# otherwise %e does not print encoding value\n+# and following test fails\n+git config --unset i18n.commitencoding\n+\n+expected=$(printf \"commit $head3\\n\\\n+Test printing of complex bodies\\n\\\n+commit $head2\\n\\\n+$changed\\n\\\n+commit $head1\\n\\\n+$added\n+\")\n+\n+test_format complex-subject %s <<EOF\n+$expected\n EOF\n \n-test_format complex-body %b <<'EOF'\n-commit f58db70b055c5718631e5c61528b28b12090cdea\n+test_format complex-body %b <<EOF\n+commit $head3\n This commit message is much longer than the others,\n-and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: ¡bueno!\n+and it will be encoded in cp1251. We should therefore\n+include an cp1251 character: так вот!\n \n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n test_expect_success '%x00 shows NUL' '\n-\techo  >expect commit f58db70b055c5718631e5c61528b28b12090cdea &&\n+\techo  >expect commit $head3 &&\n \techo >>expect fooQbar &&\n \tgit rev-list -1 --format=foo%x00bar HEAD >actual.nul &&\n \tnul_to_q <actual.nul >actual &&\n@@ -210,12 +250,12 @@ test_expect_success 'add LF before non-empty (2)' '\n \n test_expect_success 'add SP before non-empty (1)' '\n \tgit show -s --pretty=format:\"%s% bThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 2\n+\ttest $(wc -w <actual) = 3\n '\n \n test_expect_success 'add SP before non-empty (2)' '\n \tgit show -s --pretty=format:\"%s% sThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 4\n+\ttest $(wc -w <actual) = 6\n '\n \n test_expect_success '--abbrev' '\n-- \n1.7.6.3.4.gf71f\n"},{"id":"175842","messageId":"1316506892-6072-2-git-send-email-zapped@mail.ru","threadId":"28440","inReplyTo":"1316506892-6072-1-git-send-email-zapped@mail.ru","subject":"[PATCH v3 2/2] pretty: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"zapped@mail.ru","sentAt":"2011-09-20T08:21:32Z","receivedAt":"2011-09-20T08:21:32Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The following two commands are expected to give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it format \"%s\".\nLog messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted with the latter even\nwhen i18n.logOutputEncoding and terminal encoding are the same.\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\n\nSigned-off-by: Alexey Shumkin <zapped@mail.ru>\n---\n builtin/rev-list.c |    1 +\n builtin/shortlog.c |    1 +\n log-tree.c         |    1 +\n submodule.c        |    3 +++\n 4 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 56727e8..831077d 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -105,6 +105,7 @@ static void show_commit(struct commit *commit, void *data)\n \t\tctx.abbrev = revs->abbrev;\n \t\tctx.date_mode = revs->date_mode;\n \t\tctx.fmt = revs->commit_format;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &buf);\n \t\tif (revs->graph) {\n \t\t\tif (buf.len) {\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 37f3193..eba4086 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -163,6 +163,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n \t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &ufbuf);\n \t\tbuffer = ufbuf.buf;\n \t} else if (*buffer) {\ndiff --git a/log-tree.c b/log-tree.c\nindex e945701..39913d7 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -488,6 +488,7 @@ void show_log(struct rev_info *opt)\n \tctx.preserve_subject = opt->preserve_subject;\n \tctx.reflog_info = opt->reflog_info;\n \tctx.fmt = opt->commit_format;\n+\tctx.output_encoding = get_log_output_encoding();\n \tpretty_print_commit(&ctx, commit, &msgbuf);\n \n \tif (opt->add_signoff)\ndiff --git a/submodule.c b/submodule.c\nindex b648927..8c96de7 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -213,10 +213,13 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,\n \tstatic const char format[] = \"  %m %s\";\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct commit *commit;\n+\tconst char *log_output_encoding;\n \n+\tlog_output_encoding = get_log_output_encoding();\n \twhile ((commit = get_revision(rev))) {\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode = rev->date_mode;\n+\t\tctx.output_encoding = log_output_encoding;\n \t\tstrbuf_setlen(&sb, 0);\n \t\tif (commit->object.flags & SYMMETRIC_LEFT) {\n \t\t\tif (del)\n-- \n1.7.6.3.4.gf71f\n"},{"id":"175880","messageId":"7vaa9z6n9p.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"1316506892-6072-1-git-send-email-zapped@mail.ru","subject":"Re: [PATCH v3 1/2] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-20T19:12:50Z","receivedAt":"2011-09-20T19:12:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <zapped@mail.ru> writes:\n\n> diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\n> ...\n> @@ -48,28 +53,25 @@ head2=$(add_file sm1 foo3)\n>  \n>  test_expect_success 'modified submodule(forward)' \"\n\nAs this is [PATCH 1/2], doesn't this patch make this test fail, calling\nfor test_expect_failure here (and then later in 2/2 to be flipped back to\ntest_expect_success)?\n\n>  \tgit diff-index -p --submodule=log HEAD >actual &&\n> -\tcat >expected <<-EOF &&\n> -Submodule sm1 $head1..$head2:\n> -  > Add foo3\n> -EOF\n> +\tprintf \\\"Submodule sm1 $head1..$head2:\\n\\\n> +  > Add foo3 ($added foo3)\\n\\\n> +\\\" > expected &&\n>  \ttest_cmp expected actual\n>  \"\n\nHmmm... why printf?  Is it worth to force reviewers wonder what would\nhappen if any of these $variables happened to have \"%\" in them?  Are you\nbenefiting from any printf features that you cannot achieve with the\noriginal cat?\n\nThis hunk and others throughout your patch that change cat with here doc\ninto printf seem to make the tests less legible, at least to me.\n\nPerhaps like this instead, if the \"flushed left\" of the original looked\nugly to your eyes?\n\n@@ -49,27 +54,25 @@ head2=$(add_file sm1 foo3)\n test_expect_success 'modified submodule(forward)' \"\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n-Submodule sm1 $head1..$head2:\n-  > Add foo3\n-EOF\n+\tSubmodule sm1 $head1..$head2:\n+\t  > Add foo3 ($added foo3)\n+\tEOF\n \ttest_cmp expected actual\n \"\n"},{"id":"175897","messageId":"20110921004602.3d59bed4@zappedws","threadId":"28440","inReplyTo":"7vaa9z6n9p.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v3 1/2] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2011-09-20T20:46:02Z","receivedAt":"2011-09-20T20:46:02Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Alexey Shumkin <zapped@mail.ru> writes:\n> \n> > diff --git a/t/t4041-diff-submodule-option.sh\n> > b/t/t4041-diff-submodule-option.sh ...\n> > @@ -48,28 +53,25 @@ head2=$(add_file sm1 foo3)\n> >  \n> >  test_expect_success 'modified submodule(forward)' \"\n> \n> As this is [PATCH 1/2], doesn't this patch make this test fail,\n> calling for test_expect_failure here (and then later in 2/2 to be\n> flipped back to test_expect_success)?\nI did not know how is right.\nAFAIK, XP way tells to write failing tests and then \npatch/fix the code to pass them.\n\nHere, As I understand now all tests must be successful\nThe difference is in expectation of failure or success.\nOk. I got it and I will reroll the patches.\n> \n> >  \tgit diff-index -p --submodule=log HEAD >actual &&\n> > -\tcat >expected <<-EOF &&\n> > -Submodule sm1 $head1..$head2:\n> > -  > Add foo3\n> > -EOF\n> > +\tprintf \\\"Submodule sm1 $head1..$head2:\\n\\\n> > +  > Add foo3 ($added foo3)\\n\\\n> > +\\\" > expected &&\n> >  \ttest_cmp expected actual\n> >  \"\n> \n> Hmmm... why printf?  Is it worth to force reviewers wonder what would\n> happen if any of these $variables happened to have \"%\" in them?  Are\n> you benefiting from any printf features that you cannot achieve with\n> the original cat?\nThis is a remained from v1 patch code. It is not required now.\nI'll fix it. Thanks. \n\n> This hunk and others throughout your patch that change cat with here\n> doc into printf seem to make the tests less legible, at least to me.\n> \n> Perhaps like this instead, if the \"flushed left\" of the original\n> looked ugly to your eyes?\nNo, the reason was not in \"flushed left\". And, BTW, this code generates\nexpected output that has predefined format...\n> \n> @@ -49,27 +54,25 @@ head2=$(add_file sm1 foo3)\n>  test_expect_success 'modified submodule(forward)' \"\n>  \tgit diff-index -p --submodule=log HEAD >actual &&\n>  \tcat >expected <<-EOF &&\n> -Submodule sm1 $head1..$head2:\n> -  > Add foo3\n> -EOF\n> +\tSubmodule sm1 $head1..$head2:\n> +\t  > Add foo3 ($added foo3)\n> +\tEOF\n>  \ttest_cmp expected actual\n>  \"\n> \n-- \nС уважением, Алексей Шумкин\nПрограммист компании 1С-Рарус\nE-mail: ashu@rarus.ru\nICQ: 118001447\nJabber (GoogleTalk): ashu@rarus.ru\nSkype: crezoff\n"},{"id":"207681","messageId":"cover.1359018188.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"20110921004602.3d59bed4@zappedws","subject":"[PATCH v4 0/4] Reroll patches against v1.8.1.1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-24T09:10:24Z","receivedAt":"2013-01-24T09:10:24Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Woooof! \nReroll my patches again after 1.5 years ;)\nThey must be applied against v1.8.1.1\nSorry for my laziness ;)\n\nAlexey Shumkin (4):\n  t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n  t7102 (reset): refactoring: don't hardcode SHA-1 in expected outputs\n  pretty: Add failing tests: user format ignores i18n.logOutputEncoding\n    setting\n  pretty: user format ignores i18n.logOutputEncoding setting\n\n builtin/reset.c                  |   8 +-\n builtin/rev-list.c               |   1 +\n builtin/shortlog.c               |   1 +\n log-tree.c                       |   1 +\n submodule.c                      |   3 +\n t/t4041-diff-submodule-option.sh |  23 +++--\n t/t4205-log-pretty-formats.sh    |  37 ++++++--\n t/t6006-rev-list-format.sh       | 200 +++++++++++++++++++++++----------------\n t/t7102-reset.sh                 |  71 +++++++++-----\n 9 files changed, 224 insertions(+), 121 deletions(-)\n\n-- \n1.8.1.1.10.g9255f3f\n"},{"id":"207682","messageId":"cee3610fde1626c2854eb5b821529ab22a06e4bf.1359018188.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1359018188.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-24T09:10:25Z","receivedAt":"2013-01-24T09:10:25Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables.  Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t6006-rev-list-format.sh | 130 +++++++++++++++++++++++++--------------------\n 1 file changed, 72 insertions(+), 58 deletions(-)\n\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex f94f0c4..c248509 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -6,8 +6,19 @@ test_description='git rev-list --pretty=format test'\n \n test_tick\n test_expect_success 'setup' '\n-touch foo && git add foo && git commit -m \"added foo\" &&\n-  echo changed >foo && git commit -a -m \"changed foo\"\n+\ttouch foo &&\n+\tgit add foo &&\n+\tgit commit -m \"added foo\" &&\n+\thead1=$(git rev-parse --verify HEAD) &&\n+\thead1_7=$(echo $head1 | cut -c1-7) &&\n+\techo changed >foo &&\n+\tgit commit -a -m \"changed foo\" &&\n+\thead2=$(git rev-parse --verify HEAD) &&\n+\thead2_7=$(echo $head2 | cut -c1-7) &&\n+\thead2_parent=$(git cat-file -p HEAD | grep parent | cut -f 2 -d\" \") &&\n+\thead2_parent_7=$(echo $head2_parent | cut -c1-7) &&\n+\ttree2=$(git cat-file -p HEAD | grep tree | cut -f 2 -d\" \") &&\n+\ttree2_7=$(echo $tree2 | cut -c1-7)\n '\n \n # usage: test_format name format_string <expected_output\n@@ -19,49 +30,49 @@ test_cmp expect.$1 output.$1\n \"\n }\n \n-test_format percent %%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format percent %%h <<EOF\n+commit $head2\n %h\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n %h\n EOF\n \n-test_format hash %H%n%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-131a310eb913d107dd3c09a65d1651175898735d\n-131a310\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n+test_format hash %H%n%h <<EOF\n+commit $head2\n+$head2\n+$head2_7\n+commit $head1\n+$head1\n+$head1_7\n EOF\n \n-test_format tree %T%n%t <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-fe722612f26da5064c32ca3843aa154bdb0b08a0\n-fe72261\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format tree %T%n%t <<EOF\n+commit $head2\n+$tree2\n+$tree2_7\n+commit $head1\n 4d5fcadc293a348e88f777dc0920f11e7d71441c\n 4d5fcad\n EOF\n \n-test_format parents %P%n%p <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format parents %P%n%p <<EOF\n+commit $head2\n+$head1\n+$head2_parent_7\n+commit $head1\n \n \n EOF\n \n # we don't test relative here\n-test_format author %an%n%ae%n%ad%n%aD%n%at <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format author %an%n%ae%n%ad%n%aD%n%at <<EOF\n+commit $head2\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -69,14 +80,14 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<EOF\n+commit $head2\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -84,21 +95,21 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format encoding %e <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format encoding %e <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format subject %s <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format subject %s <<EOF\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format body %b <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format body %b <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n test_format raw-body %B <<'EOF'\n@@ -110,17 +121,17 @@ added foo\n \n EOF\n \n-test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<EOF\n+commit $head2\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n EOF\n \n-test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<EOF\n+commit $head2\n \u001b[1;31;43mfoo\u001b[m\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[1;31;43mfoo\u001b[m\n EOF\n \n@@ -131,39 +142,42 @@ This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: ¡bueno!\n EOF\n+\n test_expect_success 'setup complex body' '\n-git config i18n.commitencoding iso8859-1 &&\n-  echo change2 >foo && git commit -a -F commit-msg\n+\tgit config i18n.commitencoding iso8859-1 &&\n+\techo change2 >foo && git commit -a -F commit-msg &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n+\thead3_7=$(echo $head3 | cut -c1-7)\n '\n \n-test_format complex-encoding %e <<'EOF'\n-commit f58db70b055c5718631e5c61528b28b12090cdea\n+test_format complex-encoding %e <<EOF\n+commit $head3\n iso8859-1\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n-test_format complex-subject %s <<'EOF'\n-commit f58db70b055c5718631e5c61528b28b12090cdea\n+test_format complex-subject %s <<EOF\n+commit $head3\n Test printing of complex bodies\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format complex-body %b <<'EOF'\n-commit f58db70b055c5718631e5c61528b28b12090cdea\n+test_format complex-body %b <<EOF\n+commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: ¡bueno!\n \n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n test_expect_success '%x00 shows NUL' '\n-\techo  >expect commit f58db70b055c5718631e5c61528b28b12090cdea &&\n+\techo  >expect commit $head3 &&\n \techo >>expect fooQbar &&\n \tgit rev-list -1 --format=foo%x00bar HEAD >actual.nul &&\n \tnul_to_q <actual.nul >actual &&\n-- \n1.8.1.1.10.g9255f3f\n"},{"id":"207683","messageId":"63637506fa940f6dd5fc050c7fccfa5ef41993dd.1359018188.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1359018188.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 2/4] t7102 (reset): refactoring: don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-24T09:10:26Z","receivedAt":"2013-01-24T09:10:26Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables.  Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t7102-reset.sh | 41 +++++++++++++++++++++--------------------\n 1 file changed, 21 insertions(+), 20 deletions(-)\n\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex b096dc8..cf492f4 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -28,7 +28,8 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\"\n+\tgit commit -a -m \"modify 2nd file\" &&\n+\thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n \n@@ -56,7 +57,7 @@ test_expect_success 'giving a non existing revision should fail' '\n \ttest_must_fail git reset --mixed aaaaaa &&\n \ttest_must_fail git reset --soft aaaaaa &&\n \ttest_must_fail git reset --hard aaaaaa &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\tcheck_changes $head5\n '\n \n test_expect_success 'reset --soft with unmerged index should fail' '\n@@ -74,7 +75,7 @@ test_expect_success \\\n \ttest_must_fail git reset --hard -- first &&\n \ttest_must_fail git reset --soft HEAD^ -- first &&\n \ttest_must_fail git reset --hard HEAD^ -- first &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\tcheck_changes $head5\n '\n \n test_expect_success 'giving unrecognized options should fail' '\n@@ -86,7 +87,7 @@ test_expect_success 'giving unrecognized options should fail' '\n \ttest_must_fail git reset --soft -o &&\n \ttest_must_fail git reset --hard --other &&\n \ttest_must_fail git reset --hard -o &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\tcheck_changes $head5\n '\n \n test_expect_success \\\n@@ -110,7 +111,7 @@ test_expect_success \\\n \n \tgit checkout master &&\n \tgit branch -D branch1 branch2 &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\tcheck_changes $head5\n '\n \n test_expect_success \\\n@@ -133,27 +134,27 @@ test_expect_success \\\n \n \tgit checkout master &&\n \tgit branch -D branch3 branch4 &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\tcheck_changes $head5\n '\n \n test_expect_success \\\n \t'resetting to HEAD with no changes should succeed and do nothing' '\n \tgit reset --hard &&\n-\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\t\tcheck_changes $head5 &&\n \tgit reset --hard HEAD &&\n-\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\t\tcheck_changes $head5 &&\n \tgit reset --soft &&\n-\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\t\tcheck_changes $head5 &&\n \tgit reset --soft HEAD &&\n-\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\t\tcheck_changes $head5 &&\n \tgit reset --mixed &&\n-\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\t\tcheck_changes $head5 &&\n \tgit reset --mixed HEAD &&\n-\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\t\tcheck_changes $head5 &&\n \tgit reset &&\n-\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\t\tcheck_changes $head5 &&\n \tgit reset HEAD &&\n-\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\t\tcheck_changes $head5\n '\n \n >.diff_expect\n@@ -176,7 +177,7 @@ test_expect_success '--soft reset only should show changes in diff --cached' '\n \tgit reset --soft HEAD^ &&\n \tcheck_changes d1a4bc3abce4829628ae2dcb0d60ef3d1a78b1c4 &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n-\t\t\t3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\t\t\t$head5\n '\n \n >.diff_expect\n@@ -193,7 +194,7 @@ test_expect_success \\\n \tgit commit -a -C ORIG_HEAD &&\n \tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n-\t\t\t3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\t\t\t$head5\n '\n \n >.diff_expect\n@@ -303,7 +304,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n \tgit commit -a -m \"modify 2nd file\" &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\tcheck_changes $head5\n '\n \n >.diff_expect\n@@ -341,15 +342,15 @@ EOF\n test_expect_success \\\n \t'--hard reset to ORIG_HEAD should clear a fast-forward merge' '\n \tgit reset --hard HEAD^ &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\tcheck_changes $head5 &&\n \n \tgit pull . branch1 &&\n \tgit reset --hard ORIG_HEAD &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n+\tcheck_changes $head5 &&\n \n \tgit checkout master &&\n \tgit branch -D branch1 branch2 &&\n-\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n+\tcheck_changes $head5\n '\n \n cat > expect << EOF\n-- \n1.8.1.1.10.g9255f3f\n"},{"id":"207684","messageId":"6de583a2d281b1614c69d5e7b6f5c4495488f6a3.1359018188.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1359018188.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-24T09:10:27Z","receivedAt":"2013-01-24T09:10:27Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The following two commands are expected to give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it format \"%s\".\nLog messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted with the latter even\nwhen i18n.logOutputEncoding and terminal encoding are the same.\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4041-diff-submodule-option.sh | 33 ++++++++-------\n t/t4205-log-pretty-formats.sh    | 43 +++++++++++++++----\n t/t6006-rev-list-format.sh       | 90 ++++++++++++++++++++++++++--------------\n t/t7102-reset.sh                 | 32 +++++++++++---\n 4 files changed, 138 insertions(+), 60 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 32d4a60..e7d6363 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -1,6 +1,7 @@\n #!/bin/sh\n #\n # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Support for verbose submodule differences in git diff\n@@ -10,6 +11,7 @@ This test tries to verify the sanity of the --submodule option of git diff.\n \n . ./test-lib.sh\n \n+added=$(printf \"\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275\")\n add_file () {\n \t(\n \t\tcd \"$1\" &&\n@@ -19,7 +21,8 @@ add_file () {\n \t\t\techo \"$name\" >\"$name\" &&\n \t\t\tgit add \"$name\" &&\n \t\t\ttest_tick &&\n-\t\t\tgit commit -m \"Add $name\" || exit\n+\t\t\tmsg_added_cp1251=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t cp1251) &&\n+\t\t\tgit -c 'i18n.commitEncoding=cp1251' commit -m \"$msg_added_cp1251\"\n \t\tdone >/dev/null &&\n \t\tgit rev-parse --short --verify HEAD\n \t)\n@@ -89,29 +92,29 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward) --submodule' '\n+test_expect_failure 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n@@ -138,25 +141,25 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_success 'modified submodule(backward)' '\n+test_expect_failure 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_success 'modified submodule(backward and forward)' '\n+test_expect_failure 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\n-\t  > Add foo5\n-\t  > Add foo4\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  > Add foo5 ($added foo5)\n+\t  > Add foo4 ($added foo4)\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 98a43d4..76ffa0d 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -1,20 +1,31 @@\n #!/bin/sh\n #\n # Copyright (c) 2010, Will Palmer\n+# Copyright (c) 2011, Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+commit_msg() {\n+\tmsg=$(printf \"initial \\320\\272\\320\\276\\320\\274\\320\\274\\320\\270\\321\\202\")\n+\tif test -n \"$1\"; then\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'set up basic repos' '\n \t>foo &&\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit commit -m initial &&\n+\tgit config i18n.commitEncoding cp1251 &&\n+\tgit commit -m \"$(commit_msg cp1251)\" &&\n \tgit add bar &&\n \ttest_tick &&\n-\tgit commit -m \"add bar\"\n+\tgit commit -m \"add bar\" &&\n+\tgit config --unset i18n.commitEncoding\n '\n \n test_expect_success 'alias builtin format' '\n@@ -38,6 +49,20 @@ test_expect_success 'alias user-defined format' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'alias user-defined tformat with %s (cp1251 encoding)' '\n+\tgit config i18n.logOutputEncoding cp1251 &&\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\tgit config --unset i18n.logOutputEncoding &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n+test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n test_expect_success 'alias user-defined tformat' '\n \tgit log --pretty=\"tformat:%h\" >expected &&\n \tgit config pretty.test-alias \"tformat:%h\" &&\n@@ -71,22 +96,22 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_success 'NUL separation' '\n-\tprintf \"add bar\\0initial\" >expected &&\n+test_expect_failure 'NUL separation' '\n+\tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL termination' '\n-\tprintf \"add bar\\0initial\\0\" >expected &&\n+test_expect_failure 'NUL termination' '\n+\tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL separation with --stat' '\n+test_expect_failure 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n \tgit log -z --stat --pretty=\"format:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -94,7 +119,7 @@ test_expect_success 'NUL separation with --stat' '\n test_expect_failure 'NUL termination with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\\0\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n0\" >expected &&\n \tgit log -z --stat --pretty=\"tformat:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex c248509..4db43a4 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -1,33 +1,54 @@\n #!/bin/sh\n \n+# Copyright (c) 2009 Jens Lehmann\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n+\n test_description='git rev-list --pretty=format test'\n \n . ./test-lib.sh\n \n test_tick\n+added=$(printf \"added (\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275) foo\")\n+added_cp1251=$(echo \"$added\" | iconv -f utf-8 -t cp1251)\n+changed=$(printf \"changed (\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275) foo\")\n+changed_cp1251=$(echo \"$changed\" | iconv -f utf-8 -t cp1251)\n+\n test_expect_success 'setup' '\n \ttouch foo &&\n \tgit add foo &&\n-\tgit commit -m \"added foo\" &&\n+\tgit config i18n.commitEncoding cp1251 &&\n+\tgit commit -m \"$added_cp1251\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_7=$(echo $head1 | cut -c1-7) &&\n-\techo changed >foo &&\n-\tgit commit -a -m \"changed foo\" &&\n+\techo \"$changed\" > foo &&\n+\tgit commit -a -m \"$changed_cp1251\" &&\n \thead2=$(git rev-parse --verify HEAD) &&\n \thead2_7=$(echo $head2 | cut -c1-7) &&\n+\ttree2=$(git cat-file -p HEAD | grep tree | cut -f 2 -d\" \") &&\n+\ttree2_7=$(echo $tree2 | cut -c1-7) &&\n \thead2_parent=$(git cat-file -p HEAD | grep parent | cut -f 2 -d\" \") &&\n \thead2_parent_7=$(echo $head2_parent | cut -c1-7) &&\n-\ttree2=$(git cat-file -p HEAD | grep tree | cut -f 2 -d\" \") &&\n-\ttree2_7=$(echo $tree2 | cut -c1-7)\n+\tgit config --unset i18n.commitEncoding\n '\n \n # usage: test_format name format_string <expected_output\n test_format() {\n+\tlocal must_fail=0\n+\t# if parameters count is more than 2 then test must fail\n+\tif [ $# -gt 2 ]; then\n+\t\tmust_fail=1\n+\t\t# remove first parameter which is flag for test failure\n+\t\tshift\n+\tfi\n \tcat >expect.$1\n-\ttest_expect_success \"format $1\" \"\n-git rev-list --pretty=format:'$2' master >output.$1 &&\n-test_cmp expect.$1 output.$1\n-\"\n+\tname=\"format $1\"\n+\tcommand=\"git rev-list --pretty=format:'$2' master >output.$1 &&\n+test_cmp expect.$1 output.$1\"\n+\tif [ $must_fail -eq 1 ]; then\n+\t\ttest_expect_failure \"$name\" \"$command\"\n+\telse\n+\t\ttest_expect_success \"$name\" \"$command\"\n+\tfi\n }\n \n test_format percent %%h <<EOF\n@@ -95,16 +116,16 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format encoding %e <<EOF\n+test_format failure encoding %e <<EOF\n commit $head2\n commit $head1\n EOF\n \n-test_format subject %s <<EOF\n+test_format failure subject %s <<EOF\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n test_format body %b <<EOF\n@@ -112,12 +133,12 @@ commit $head2\n commit $head1\n EOF\n \n-test_format raw-body %B <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-changed foo\n+test_format failure raw-body %B <<EOF\n+commit $head2\n+$changed\n \n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-added foo\n+commit $head1\n+$added\n \n EOF\n \n@@ -135,16 +156,16 @@ commit $head1\n \u001b[1;31;43mfoo\u001b[m\n EOF\n \n-cat >commit-msg <<'EOF'\n+iconv -f utf-8 -t cp1251 > commit-msg <<EOF\n Test printing of complex bodies\n \n This commit message is much longer than the others,\n-and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: ¡bueno!\n+and it will be encoded in cp1251. We should therefore\n+include an cp1251 character: так вот!\n EOF\n \n test_expect_success 'setup complex body' '\n-\tgit config i18n.commitencoding iso8859-1 &&\n+\tgit config i18n.commitencoding cp1251 &&\n \techo change2 >foo && git commit -a -F commit-msg &&\n \thead3=$(git rev-parse --verify HEAD) &&\n \thead3_7=$(echo $head3 | cut -c1-7)\n@@ -152,25 +173,32 @@ test_expect_success 'setup complex body' '\n \n test_format complex-encoding %e <<EOF\n commit $head3\n-iso8859-1\n+cp1251\n commit $head2\n+cp1251\n commit $head1\n+cp1251\n EOF\n \n-test_format complex-subject %s <<EOF\n+# unset commit encoding config\n+# otherwise %e does not print encoding value\n+# and following test fails\n+git config --unset i18n.commitencoding\n+\n+test_format failure complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n-test_format complex-body %b <<EOF\n+test_format failure complex-body %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n-and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: ¡bueno!\n+and it will be encoded in cp1251. We should therefore\n+include an cp1251 character: так вот!\n \n commit $head2\n commit $head1\n@@ -224,12 +252,12 @@ test_expect_success 'add LF before non-empty (2)' '\n \n test_expect_success 'add SP before non-empty (1)' '\n \tgit show -s --pretty=format:\"%s% bThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 2\n+\ttest $(wc -w <actual) = 3\n '\n \n test_expect_success 'add SP before non-empty (2)' '\n \tgit show -s --pretty=format:\"%s% sThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 4\n+\ttest $(wc -w <actual) = 6\n '\n \n test_expect_success '--abbrev' '\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex cf492f4..699c824 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -9,6 +9,14 @@ Documented tests for git reset'\n \n . ./test-lib.sh\n \n+commit_msg() {\n+\tmsg=$(printf \"modify 2nd file (\\320\\270\\320\\267\\320\\274\\320\\265\\320\\275\\321\\221\\320\\275 \\321\\204\\320\\260\\320\\271\\320\\273)\")\n+\tif test -n \"$1\"; then\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'creating initial files and commits' '\n \ttest_tick &&\n \techo \"1st file\" >first &&\n@@ -28,7 +36,7 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=cp1251\" commit -a -m \"$(commit_msg cp1251)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -44,6 +52,20 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n+test_expect_failure 'reset --hard message' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg) > .expected &&\n+\ttest_cmp .actual .expected\n+'\n+\n+test_expect_success 'reset --hard message (cp1251 logoutencoding)' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit -c \"i18n.logOutputEncoding=cp1251\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg cp1251) > .expected &&\n+\ttest_cmp .actual .expected\n+'\n+\n >.diff_expect\n >.cached_expect\n cat >.cat_expect <<EOF\n@@ -192,7 +214,7 @@ test_expect_success \\\n \t'changing files and redo the last commit should succeed' '\n \techo \"3rd line 2nd file\" >>secondfile &&\n \tgit commit -a -C ORIG_HEAD &&\n-\tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n+\tcheck_changes f06f78b8dd468c722952b77569dd0db212442c25 &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n \t\t\t$head5\n '\n@@ -211,7 +233,7 @@ test_expect_success \\\n \tgit reset --hard HEAD~2 &&\n \tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n-\t\t\t3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d\n+\t\t\tf06f78b8dd468c722952b77569dd0db212442c25\n '\n \n >.diff_expect\n@@ -303,7 +325,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=cp1251\" commit -a -m \"$(commit_msg cp1251)\" &&\n \tcheck_changes $head5\n '\n \n@@ -329,7 +351,7 @@ test_expect_success '--hard reset to HEAD should clear a failed merge' '\n \n \ttest_must_fail git pull . branch1 &&\n \tgit reset --hard &&\n-\tcheck_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb\n+\tcheck_changes f26fb896db2344fe158ce3720249e1df4d26174b\n '\n \n >.diff_expect\n-- \n1.8.1.1.10.g9255f3f\n"},{"id":"207685","messageId":"4abd10a4e24ba7af54fba77177219f44d39f6db7.1359018188.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1359018188.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 4/4] pretty: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-24T09:10:28Z","receivedAt":"2013-01-24T09:10:28Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"From: Alexey Shumkin <zapped@mail.ru>\n\nThe following two commands are expected to give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it format \"%s\".\nLog messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted with the latter even\nwhen i18n.logOutputEncoding and terminal encoding are the same.\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n builtin/reset.c                  |  8 ++++++--\n builtin/rev-list.c               |  1 +\n builtin/shortlog.c               |  1 +\n log-tree.c                       |  1 +\n submodule.c                      |  3 +++\n t/t4041-diff-submodule-option.sh | 10 +++++-----\n t/t4205-log-pretty-formats.sh    |  8 ++++----\n t/t6006-rev-list-format.sh       | 10 +++++-----\n t/t7102-reset.sh                 |  2 +-\n 9 files changed, 27 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 915cc9f..11c0aa4 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -100,11 +100,15 @@ static int reset_index_file(const unsigned char *sha1, int reset_type, int quiet\n \n static void print_new_head_line(struct commit *commit)\n {\n-\tconst char *hex, *body;\n+\tconst char *hex, *body, *encoding;\n \n \thex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);\n \tprintf(_(\"HEAD is now at %s\"), hex);\n-\tbody = strstr(commit->buffer, \"\\n\\n\");\n+\tencoding = get_log_output_encoding();\n+\tbody = logmsg_reencode(commit, encoding);\n+\tif (!body)\n+\t\tbody = commit->buffer;\n+\tbody = strstr(body, \"\\n\\n\");\n \tif (body) {\n \t\tconst char *eol;\n \t\tsize_t len;\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 67701be..a5ec30d 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -111,6 +111,7 @@ static void show_commit(struct commit *commit, void *data)\n \t\tctx.date_mode = revs->date_mode;\n \t\tctx.date_mode_explicit = revs->date_mode_explicit;\n \t\tctx.fmt = revs->commit_format;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &buf);\n \t\tif (revs->graph) {\n \t\t\tif (buf.len) {\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 8360514..23c05cd 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -163,6 +163,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n \t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &ufbuf);\n \t\tbuffer = ufbuf.buf;\n \t} else if (*buffer) {\ndiff --git a/log-tree.c b/log-tree.c\nindex 4f86def..e1ff3a5 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -671,6 +671,7 @@ void show_log(struct rev_info *opt)\n \tctx.preserve_subject = opt->preserve_subject;\n \tctx.reflog_info = opt->reflog_info;\n \tctx.fmt = opt->commit_format;\n+\tctx.output_encoding = get_log_output_encoding();\n \tpretty_print_commit(&ctx, commit, &msgbuf);\n \n \tif (opt->add_signoff)\ndiff --git a/submodule.c b/submodule.c\nindex 2f55436..8e42750 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -222,10 +222,13 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,\n \tstatic const char format[] = \"  %m %s\";\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct commit *commit;\n+\tconst char *log_output_encoding;\n \n+\tlog_output_encoding = get_log_output_encoding();\n \twhile ((commit = get_revision(rev))) {\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode = rev->date_mode;\n+\t\tctx.output_encoding = log_output_encoding;\n \t\tstrbuf_setlen(&sb, 0);\n \t\tif (commit->object.flags & SYMMETRIC_LEFT) {\n \t\t\tif (del)\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex e7d6363..39f0609 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -92,7 +92,7 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -101,7 +101,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -110,7 +110,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward) --submodule' '\n+test_expect_success 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -141,7 +141,7 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_failure 'modified submodule(backward)' '\n+test_expect_success 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n@@ -152,7 +152,7 @@ test_expect_failure 'modified submodule(backward)' '\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_failure 'modified submodule(backward and forward)' '\n+test_expect_success 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 76ffa0d..54a9704 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -57,7 +57,7 @@ test_expect_success 'alias user-defined tformat with %s (cp1251 encoding)' '\n \ttest_cmp expected-s actual-s\n '\n \n-test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+test_expect_success 'alias user-defined tformat with %s (utf-8 encoding)' '\n \tgit log --oneline >expected-s &&\n \tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n \ttest_cmp expected-s actual-s\n@@ -96,19 +96,19 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_failure 'NUL separation' '\n+test_expect_success 'NUL separation' '\n \tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL termination' '\n+test_expect_success 'NUL termination' '\n \tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL separation with --stat' '\n+test_expect_success 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n \tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 4db43a4..006e6ab 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -116,12 +116,12 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format failure encoding %e <<EOF\n+test_format encoding %e <<EOF\n commit $head2\n commit $head1\n EOF\n \n-test_format failure subject %s <<EOF\n+test_format subject %s <<EOF\n commit $head2\n $changed\n commit $head1\n@@ -133,7 +133,7 @@ commit $head2\n commit $head1\n EOF\n \n-test_format failure raw-body %B <<EOF\n+test_format raw-body %B <<EOF\n commit $head2\n $changed\n \n@@ -185,7 +185,7 @@ EOF\n # and following test fails\n git config --unset i18n.commitencoding\n \n-test_format failure complex-subject %s <<EOF\n+test_format complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n@@ -194,7 +194,7 @@ commit $head1\n $added\n EOF\n \n-test_format failure complex-body %b <<EOF\n+test_format complex-body %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in cp1251. We should therefore\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 699c824..ea14c97 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -52,7 +52,7 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n-test_expect_failure 'reset --hard message' '\n+test_expect_success 'reset --hard message' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg) > .expected &&\n-- \n1.8.1.1.10.g9255f3f\n"},{"id":"207714","messageId":"7v38xqba04.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"cee3610fde1626c2854eb5b821529ab22a06e4bf.1359018188.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-24T20:29:15Z","receivedAt":"2013-01-24T20:29:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> The expected SHA-1 digests are always available in variables.  Use\n> them instead of hardcoding.\n>\n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> ---\n>  t/t6006-rev-list-format.sh | 130 +++++++++++++++++++++++++--------------------\n>  1 file changed, 72 insertions(+), 58 deletions(-)\n>\n> diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> index f94f0c4..c248509 100755\n> --- a/t/t6006-rev-list-format.sh\n> +++ b/t/t6006-rev-list-format.sh\n> @@ -6,8 +6,19 @@ test_description='git rev-list --pretty=format test'\n>  \n>  test_tick\n>  test_expect_success 'setup' '\n> -touch foo && git add foo && git commit -m \"added foo\" &&\n> -  echo changed >foo && git commit -a -m \"changed foo\"\n> +\ttouch foo &&\n\nThis is inherited from the original, but these days we try to avoid\ntouch, unless it is about setting a new file timestamp.  The\ncanonical (in the script we write) way to create an empty file is:\n\n    : >foo\n\nwith or without \": \", it does not matter that much.\n\n> +\tgit add foo &&\n> +\tgit commit -m \"added foo\" &&\n> +\thead1=$(git rev-parse --verify HEAD) &&\n> +\thead1_7=$(echo $head1 | cut -c1-7) &&\n\nWhy do we want \"whatever_7\" variables and use \"cut -c1-7\" to produce\nthem?  Is \"7\" something we care deeply about?\n\nI think what we care a lot more than \"7\" that happens to be the\ncurrent default value is to make sure that, if we ever update the\ndefault abbreviation length to a larger value, the abbreviation\nshown with --format=%h is consistent with the abbreviation that is\ngiven by rev-parse --short.\n\n    head1_short=$(git rev-parse --short $head1)\n\nperhaps?\n\n> +\techo changed >foo &&\n> +\tgit commit -a -m \"changed foo\" &&\n> +\thead2=$(git rev-parse --verify HEAD) &&\n> +\thead2_7=$(echo $head2 | cut -c1-7) &&\n> +\thead2_parent=$(git cat-file -p HEAD | grep parent | cut -f 2 -d\" \") &&\n\nDo not use \"cat-file -p\" that is for human consumption in scripts,\nunless you are testing how the format for human consumption should\nlook like (we may later add more pretty-print to them), which is not\nthe case here.\n\nAlso be careful and pay attention to the end of the header; you do\nnot want to pick up a random \"parent\" string in the middle of a log\nmessage.\n\n    head2_parent=$(git cat-file commit HEAD | sed -n -e \"s/^parent //p\" -e \"/^$/q\")\n\nwould be much better.\n\n> +\thead2_parent_7=$(echo $head2_parent | cut -c1-7) &&\n> +\ttree2=$(git cat-file -p HEAD | grep tree | cut -f 2 -d\" \") &&\n\nLikewise.\n\n> +\ttree2_7=$(echo $tree2 | cut -c1-7)\n\nLikewise.\n\n> @@ -131,39 +142,42 @@ This commit message is much longer than the others,\n>  and it will be encoded in iso8859-1. We should therefore\n>  include an iso8859 character: ¡bueno!\n>  EOF\n> +\n>  test_expect_success 'setup complex body' '\n> -git config i18n.commitencoding iso8859-1 &&\n> -  echo change2 >foo && git commit -a -F commit-msg\n> +\tgit config i18n.commitencoding iso8859-1 &&\n> +\techo change2 >foo && git commit -a -F commit-msg &&\n> +\thead3=$(git rev-parse --verify HEAD) &&\n> +\thead3_7=$(echo $head3 | cut -c1-7)\n>  '\n\nLikewise.\n\nThanks.\n"},{"id":"207715","messageId":"7vy5fi9vcz.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"63637506fa940f6dd5fc050c7fccfa5ef41993dd.1359018188.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v4 2/4] t7102 (reset): refactoring: don't hardcode SHA-1 in expected outputs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-24T20:30:52Z","receivedAt":"2013-01-24T20:30:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> The expected SHA-1 digests are always available in variables.  Use\n> them instead of hardcoding.\n>\n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> ---\n\nLooks good (\" refactoring:\" in the title may not want to be there,\nthough).\n\nThanks.\n\n>  t/t7102-reset.sh | 41 +++++++++++++++++++++--------------------\n>  1 file changed, 21 insertions(+), 20 deletions(-)\n>\n> diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\n> index b096dc8..cf492f4 100755\n> --- a/t/t7102-reset.sh\n> +++ b/t/t7102-reset.sh\n> @@ -28,7 +28,8 @@ test_expect_success 'creating initial files and commits' '\n>  \n>  \techo \"1st line 2nd file\" >secondfile &&\n>  \techo \"2nd line 2nd file\" >>secondfile &&\n> -\tgit commit -a -m \"modify 2nd file\"\n> +\tgit commit -a -m \"modify 2nd file\" &&\n> +\thead5=$(git rev-parse --verify HEAD)\n>  '\n>  # git log --pretty=oneline # to see those SHA1 involved\n>  \n> @@ -56,7 +57,7 @@ test_expect_success 'giving a non existing revision should fail' '\n>  \ttest_must_fail git reset --mixed aaaaaa &&\n>  \ttest_must_fail git reset --soft aaaaaa &&\n>  \ttest_must_fail git reset --hard aaaaaa &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\tcheck_changes $head5\n>  '\n>  \n>  test_expect_success 'reset --soft with unmerged index should fail' '\n> @@ -74,7 +75,7 @@ test_expect_success \\\n>  \ttest_must_fail git reset --hard -- first &&\n>  \ttest_must_fail git reset --soft HEAD^ -- first &&\n>  \ttest_must_fail git reset --hard HEAD^ -- first &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\tcheck_changes $head5\n>  '\n>  \n>  test_expect_success 'giving unrecognized options should fail' '\n> @@ -86,7 +87,7 @@ test_expect_success 'giving unrecognized options should fail' '\n>  \ttest_must_fail git reset --soft -o &&\n>  \ttest_must_fail git reset --hard --other &&\n>  \ttest_must_fail git reset --hard -o &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\tcheck_changes $head5\n>  '\n>  \n>  test_expect_success \\\n> @@ -110,7 +111,7 @@ test_expect_success \\\n>  \n>  \tgit checkout master &&\n>  \tgit branch -D branch1 branch2 &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\tcheck_changes $head5\n>  '\n>  \n>  test_expect_success \\\n> @@ -133,27 +134,27 @@ test_expect_success \\\n>  \n>  \tgit checkout master &&\n>  \tgit branch -D branch3 branch4 &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\tcheck_changes $head5\n>  '\n>  \n>  test_expect_success \\\n>  \t'resetting to HEAD with no changes should succeed and do nothing' '\n>  \tgit reset --hard &&\n> -\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\t\tcheck_changes $head5 &&\n>  \tgit reset --hard HEAD &&\n> -\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\t\tcheck_changes $head5 &&\n>  \tgit reset --soft &&\n> -\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\t\tcheck_changes $head5 &&\n>  \tgit reset --soft HEAD &&\n> -\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\t\tcheck_changes $head5 &&\n>  \tgit reset --mixed &&\n> -\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\t\tcheck_changes $head5 &&\n>  \tgit reset --mixed HEAD &&\n> -\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\t\tcheck_changes $head5 &&\n>  \tgit reset &&\n> -\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\t\tcheck_changes $head5 &&\n>  \tgit reset HEAD &&\n> -\t\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\t\tcheck_changes $head5\n>  '\n>  \n>  >.diff_expect\n> @@ -176,7 +177,7 @@ test_expect_success '--soft reset only should show changes in diff --cached' '\n>  \tgit reset --soft HEAD^ &&\n>  \tcheck_changes d1a4bc3abce4829628ae2dcb0d60ef3d1a78b1c4 &&\n>  \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n> -\t\t\t3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\t\t\t$head5\n>  '\n>  \n>  >.diff_expect\n> @@ -193,7 +194,7 @@ test_expect_success \\\n>  \tgit commit -a -C ORIG_HEAD &&\n>  \tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n>  \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n> -\t\t\t3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\t\t\t$head5\n>  '\n>  \n>  >.diff_expect\n> @@ -303,7 +304,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n>  \techo \"1st line 2nd file\" >secondfile &&\n>  \techo \"2nd line 2nd file\" >>secondfile &&\n>  \tgit commit -a -m \"modify 2nd file\" &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\tcheck_changes $head5\n>  '\n>  \n>  >.diff_expect\n> @@ -341,15 +342,15 @@ EOF\n>  test_expect_success \\\n>  \t'--hard reset to ORIG_HEAD should clear a fast-forward merge' '\n>  \tgit reset --hard HEAD^ &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\tcheck_changes $head5 &&\n>  \n>  \tgit pull . branch1 &&\n>  \tgit reset --hard ORIG_HEAD &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> +\tcheck_changes $head5 &&\n>  \n>  \tgit checkout master &&\n>  \tgit branch -D branch1 branch2 &&\n> -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> +\tcheck_changes $head5\n>  '\n>  \n>  cat > expect << EOF\n"},{"id":"207716","messageId":"7vr4la9uqo.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"6de583a2d281b1614c69d5e7b6f5c4495488f6a3.1359018188.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-24T20:44:15Z","receivedAt":"2013-01-24T20:44:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> The following two commands are expected to give the same output to a terminal:\n>\n> \t$ git log --oneline --no-color\n> \t$ git log --pretty=format:'%h %s'\n>\n> However, the former pays attention to i18n.logOutputEncoding\n> configuration, while the latter does not when it format \"%s\".\n> Log messages written in an encoding i18n.commitEncoding which differs\n> from terminal encoding are shown corrupted with the latter even\n> when i18n.logOutputEncoding and terminal encoding are the same.\n>\n> The same corruption is true for\n> \t$ git diff --submodule=log\n> and\n> \t$ git rev-list --pretty=format:%s HEAD\n> and\n> \t$ git reset --hard\n>\n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> ---\n>  t/t4041-diff-submodule-option.sh | 33 ++++++++-------\n>  t/t4205-log-pretty-formats.sh    | 43 +++++++++++++++----\n>  t/t6006-rev-list-format.sh       | 90 ++++++++++++++++++++++++++--------------\n>  t/t7102-reset.sh                 | 32 +++++++++++---\n>  4 files changed, 138 insertions(+), 60 deletions(-)\n>\n> diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\n> index 32d4a60..e7d6363 100755\n> --- a/t/t4041-diff-submodule-option.sh\n> +++ b/t/t4041-diff-submodule-option.sh\n> @@ -1,6 +1,7 @@\n>  #!/bin/sh\n>  #\n>  # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin\n> +# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n>  #\n>  \n>  test_description='Support for verbose submodule differences in git diff\n> @@ -10,6 +11,7 @@ This test tries to verify the sanity of the --submodule option of git diff.\n>  \n>  . ./test-lib.sh\n>  \n> +added=$(printf \"\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275\")\n\nPlease have an in-code comment before this line to explain what this\nvariable is about, e.g.\n\n\t# String \"added\" in Russian, encoded in UTF-8, used in\n        # sample commit log messages in add_file() function below.\n        added=$(printf \"...\")\n\n>  add_file () {\n>  \t(\n>  \t\tcd \"$1\" &&\n> @@ -19,7 +21,8 @@ add_file () {\n>  \t\t\techo \"$name\" >\"$name\" &&\n>  \t\t\tgit add \"$name\" &&\n>  \t\t\ttest_tick &&\n> -\t\t\tgit commit -m \"Add $name\" || exit\n> +\t\t\tmsg_added_cp1251=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t cp1251) &&\n> +\t\t\tgit -c 'i18n.commitEncoding=cp1251' commit -m \"$msg_added_cp1251\"\n>  \t\tdone >/dev/null &&\n>  \t\tgit rev-parse --short --verify HEAD\n>  \t)\n\nDoes this patch make the all tests in this script fail for people\nwithout cp1251 locale installed?  We already have tests that depend\non 8859-1 and some other locales, and we'd be better off limiting\nsuch dependency to the minimum.\n\nSame comment applies to the changes to other test scripts.\n\nThanks.\n"},{"id":"207718","messageId":"7vip6m9tvj.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"6de583a2d281b1614c69d5e7b6f5c4495488f6a3.1359018188.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-24T21:02:56Z","receivedAt":"2013-01-24T21:02:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> index c248509..4db43a4 100755\n> --- a/t/t6006-rev-list-format.sh\n> +++ b/t/t6006-rev-list-format.sh\n> ...\n> @@ -112,12 +133,12 @@ commit $head2\n>  commit $head1\n>  EOF\n>  \n> -test_format raw-body %B <<'EOF'\n> -commit 131a310eb913d107dd3c09a65d1651175898735d\n> -changed foo\n> +test_format failure raw-body %B <<EOF\n> +commit $head2\n> +$changed\n>  \n> -commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n> -added foo\n> +commit $head1\n> +$added\n>  \n>  EOF\n\nIt may have been easier to follow if you did this \"Don't hardcode\"\nas a separate preparatory patch, like your first two patches.\n\n> @@ -135,16 +156,16 @@ commit $head1\n>  foo\n>  EOF\n>  \n> -cat >commit-msg <<'EOF'\n> +iconv -f utf-8 -t cp1251 > commit-msg <<EOF\n>  Test printing of complex bodies\n>  \n>  This commit message is much longer than the others,\n> -and it will be encoded in iso8859-1. We should therefore\n> -include an iso8859 character: ¡bueno!\n> +and it will be encoded in cp1251. We should therefore\n> +include an cp1251 character: так вот!\n>  EOF\n>  \n>  test_expect_success 'setup complex body' '\n> -\tgit config i18n.commitencoding iso8859-1 &&\n> +\tgit config i18n.commitencoding cp1251 &&\n\nWhat is going on here?\n\nIs this an example that shows that i18n.commitencoding works\ncorrectly with iso8859-1 but not with cp1251?  \n\n> diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\n> index cf492f4..699c824 100755\n> --- a/t/t7102-reset.sh\n> +++ b/t/t7102-reset.sh\n> ...\n> @@ -192,7 +214,7 @@ test_expect_success \\\n>  \t'changing files and redo the last commit should succeed' '\n>  \techo \"3rd line 2nd file\" >>secondfile &&\n>  \tgit commit -a -C ORIG_HEAD &&\n> -\tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n> +\tcheck_changes f06f78b8dd468c722952b77569dd0db212442c25 &&\n>  \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n>  \t\t\t$head5\n>  '\n\nThis and remaining hunks to this script shows that it would be\nhelped by the same love you gave to other scripts with your first\ntwo patches before you add the \"non-unicode\" tests, no?\n"},{"id":"207776","messageId":"20130125130152.63f7c14f@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vip6m9tvj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-25T09:01:52Z","receivedAt":"2013-01-25T09:01:52Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> > diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> > index c248509..4db43a4 100755\n> > --- a/t/t6006-rev-list-format.sh\n> > +++ b/t/t6006-rev-list-format.sh\n> > ...\n> > @@ -112,12 +133,12 @@ commit $head2\n> >  commit $head1\n> >  EOF\n> >  \n> > -test_format raw-body %B <<'EOF'\n> > -commit 131a310eb913d107dd3c09a65d1651175898735d\n> > -changed foo\n> > +test_format failure raw-body %B <<EOF\n> > +commit $head2\n> > +$changed\n> >  \n> > -commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n> > -added foo\n> > +commit $head1\n> > +$added\n> >  \n> >  EOF\n> \n> It may have been easier to follow if you did this \"Don't hardcode\"\n> as a separate preparatory patch, like your first two patches.\nYep, I missed that in my bunch of rebasing ;)\n\n> \n> > @@ -135,16 +156,16 @@ commit $head1\n> >  foo\n> >  EOF\n> >  \n> > -cat >commit-msg <<'EOF'\n> > +iconv -f utf-8 -t cp1251 > commit-msg <<EOF\n> >  Test printing of complex bodies\n> >  \n> >  This commit message is much longer than the others,\n> > -and it will be encoded in iso8859-1. We should therefore\n> > -include an iso8859 character: ¡bueno!\n> > +and it will be encoded in cp1251. We should therefore\n> > +include an cp1251 character: так вот!\n> >  EOF\n> >  \n> >  test_expect_success 'setup complex body' '\n> > -\tgit config i18n.commitencoding iso8859-1 &&\n> > +\tgit config i18n.commitencoding cp1251 &&\n> \n> What is going on here?\n> \n> Is this an example that shows that i18n.commitencoding works\n> correctly with iso8859-1 but not with cp1251?\nIt show only that I speak and write Russian not Spanish ))\nI'll revert back these changes.\n\n> \n> > diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\n> > index cf492f4..699c824 100755\n> > --- a/t/t7102-reset.sh\n> > +++ b/t/t7102-reset.sh\n> > ...\n> > @@ -192,7 +214,7 @@ test_expect_success \\\n> >  \t'changing files and redo the last commit should succeed' '\n> >  \techo \"3rd line 2nd file\" >>secondfile &&\n> >  \tgit commit -a -C ORIG_HEAD &&\n> > -\tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n> > +\tcheck_changes f06f78b8dd468c722952b77569dd0db212442c25 &&\n> >  \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n> >  \t\t\t$head5\n> >  '\n> \n> This and remaining hunks to this script shows that it would be\n> helped by the same love you gave to other scripts with your first\n> two patches before you add the \"non-unicode\" tests, no?\nSorry, I haven't got you :-[ (it seems, my English is not good enough)\nDo you mean \"avoid hardcoded SHA-1\"?\n"},{"id":"207778","messageId":"20130125130708.75224a8b@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vr4la9uqo.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-25T09:07:08Z","receivedAt":"2013-01-25T09:07:08Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> > The following two commands are expected to give the same output to\n> > a terminal:\n> >\n> > \t$ git log --oneline --no-color\n> > \t$ git log --pretty=format:'%h %s'\n> >\n> > However, the former pays attention to i18n.logOutputEncoding\n> > configuration, while the latter does not when it format \"%s\".\n> > Log messages written in an encoding i18n.commitEncoding which\n> > differs from terminal encoding are shown corrupted with the latter\n> > even when i18n.logOutputEncoding and terminal encoding are the same.\n> >\n> > The same corruption is true for\n> > \t$ git diff --submodule=log\n> > and\n> > \t$ git rev-list --pretty=format:%s HEAD\n> > and\n> > \t$ git reset --hard\n> >\n> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> > ---\n> >  t/t4041-diff-submodule-option.sh | 33 ++++++++-------\n> >  t/t4205-log-pretty-formats.sh    | 43 +++++++++++++++----\n> >  t/t6006-rev-list-format.sh       | 90\n> > ++++++++++++++++++++++++++--------------\n> > t/t7102-reset.sh                 | 32 +++++++++++--- 4 files\n> > changed, 138 insertions(+), 60 deletions(-)\n> >\n> > diff --git a/t/t4041-diff-submodule-option.sh\n> > b/t/t4041-diff-submodule-option.sh index 32d4a60..e7d6363 100755\n> > --- a/t/t4041-diff-submodule-option.sh\n> > +++ b/t/t4041-diff-submodule-option.sh\n> > @@ -1,6 +1,7 @@\n> >  #!/bin/sh\n> >  #\n> >  # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin\n> > +# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding\n> > tests) #\n> >  \n> >  test_description='Support for verbose submodule differences in git\n> > diff @@ -10,6 +11,7 @@ This test tries to verify the sanity of the\n> > --submodule option of git diff. \n> >  . ./test-lib.sh\n> >  \n> > +added=$(printf\n> > \"\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275\")\n> \n> Please have an in-code comment before this line to explain what this\n> variable is about, e.g.\n> \n> \t# String \"added\" in Russian, encoded in UTF-8, used in\n>         # sample commit log messages in add_file() function below.\n>         added=$(printf \"...\")\nOk!\n\n> \n> >  add_file () {\n> >  \t(\n> >  \t\tcd \"$1\" &&\n> > @@ -19,7 +21,8 @@ add_file () {\n> >  \t\t\techo \"$name\" >\"$name\" &&\n> >  \t\t\tgit add \"$name\" &&\n> >  \t\t\ttest_tick &&\n> > -\t\t\tgit commit -m \"Add $name\" || exit\n> > +\t\t\tmsg_added_cp1251=$(echo \"Add $name ($added\n> > $name)\" | iconv -f utf-8 -t cp1251) &&\n> > +\t\t\tgit -c 'i18n.commitEncoding=cp1251' commit\n> > -m \"$msg_added_cp1251\" done >/dev/null &&\n> >  \t\tgit rev-parse --short --verify HEAD\n> >  \t)\n> \n> Does this patch make the all tests in this script fail for people\n> without cp1251 locale installed?  We already have tests that depend\n> on 8859-1 and some other locales, and we'd be better off limiting\n> such dependency to the minimum.\nHmmm, I'll try to feign something to avoid using cp1251\n\n> \n> Same comment applies to the changes to other test scripts.\n> \n> Thanks.\n"},{"id":"207779","messageId":"20130125130859.02acc8f8@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vy5fi9vcz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 2/4] t7102 (reset): refactoring: don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-25T09:08:59Z","receivedAt":"2013-01-25T09:08:59Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> > The expected SHA-1 digests are always available in variables.  Use\n> > them instead of hardcoding.\n> >\n> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> > ---\n> \n> Looks good (\" refactoring:\" in the title may not want to be there,\n> though).\noops, it's remained from \"working version\" after rebasing\n\n> \n> Thanks.\n> \n> >  t/t7102-reset.sh | 41 +++++++++++++++++++++--------------------\n> >  1 file changed, 21 insertions(+), 20 deletions(-)\n> >\n> > diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\n> > index b096dc8..cf492f4 100755\n> > --- a/t/t7102-reset.sh\n> > +++ b/t/t7102-reset.sh\n> > @@ -28,7 +28,8 @@ test_expect_success 'creating initial files and\n> > commits' ' \n> >  \techo \"1st line 2nd file\" >secondfile &&\n> >  \techo \"2nd line 2nd file\" >>secondfile &&\n> > -\tgit commit -a -m \"modify 2nd file\"\n> > +\tgit commit -a -m \"modify 2nd file\" &&\n> > +\thead5=$(git rev-parse --verify HEAD)\n> >  '\n> >  # git log --pretty=oneline # to see those SHA1 involved\n> >  \n> > @@ -56,7 +57,7 @@ test_expect_success 'giving a non existing\n> > revision should fail' ' test_must_fail git reset --mixed aaaaaa &&\n> >  \ttest_must_fail git reset --soft aaaaaa &&\n> >  \ttest_must_fail git reset --hard aaaaaa &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\tcheck_changes $head5\n> >  '\n> >  \n> >  test_expect_success 'reset --soft with unmerged index should fail'\n> > ' @@ -74,7 +75,7 @@ test_expect_success \\\n> >  \ttest_must_fail git reset --hard -- first &&\n> >  \ttest_must_fail git reset --soft HEAD^ -- first &&\n> >  \ttest_must_fail git reset --hard HEAD^ -- first &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\tcheck_changes $head5\n> >  '\n> >  \n> >  test_expect_success 'giving unrecognized options should fail' '\n> > @@ -86,7 +87,7 @@ test_expect_success 'giving unrecognized options\n> > should fail' ' test_must_fail git reset --soft -o &&\n> >  \ttest_must_fail git reset --hard --other &&\n> >  \ttest_must_fail git reset --hard -o &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\tcheck_changes $head5\n> >  '\n> >  \n> >  test_expect_success \\\n> > @@ -110,7 +111,7 @@ test_expect_success \\\n> >  \n> >  \tgit checkout master &&\n> >  \tgit branch -D branch1 branch2 &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\tcheck_changes $head5\n> >  '\n> >  \n> >  test_expect_success \\\n> > @@ -133,27 +134,27 @@ test_expect_success \\\n> >  \n> >  \tgit checkout master &&\n> >  \tgit branch -D branch3 branch4 &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\tcheck_changes $head5\n> >  '\n> >  \n> >  test_expect_success \\\n> >  \t'resetting to HEAD with no changes should succeed and do\n> > nothing' ' git reset --hard &&\n> > -\t\tcheck_changes\n> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\t\tcheck_changes $head5 &&\n> >  \tgit reset --hard HEAD &&\n> > -\t\tcheck_changes\n> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\t\tcheck_changes $head5 &&\n> >  \tgit reset --soft &&\n> > -\t\tcheck_changes\n> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\t\tcheck_changes $head5 &&\n> >  \tgit reset --soft HEAD &&\n> > -\t\tcheck_changes\n> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\t\tcheck_changes $head5 &&\n> >  \tgit reset --mixed &&\n> > -\t\tcheck_changes\n> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\t\tcheck_changes $head5 &&\n> >  \tgit reset --mixed HEAD &&\n> > -\t\tcheck_changes\n> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\t\tcheck_changes $head5 &&\n> >  \tgit reset &&\n> > -\t\tcheck_changes\n> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\t\tcheck_changes $head5 &&\n> >  \tgit reset HEAD &&\n> > -\t\tcheck_changes\n> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\t\tcheck_changes $head5\n> >  '\n> >  \n> >  >.diff_expect\n> > @@ -176,7 +177,7 @@ test_expect_success '--soft reset only should\n> > show changes in diff --cached' ' git reset --soft HEAD^ &&\n> >  \tcheck_changes d1a4bc3abce4829628ae2dcb0d60ef3d1a78b1c4 &&\n> >  \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n> > -\t\t\t3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\t\t\t$head5\n> >  '\n> >  \n> >  >.diff_expect\n> > @@ -193,7 +194,7 @@ test_expect_success \\\n> >  \tgit commit -a -C ORIG_HEAD &&\n> >  \tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n> >  \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n> > -\t\t\t3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\t\t\t$head5\n> >  '\n> >  \n> >  >.diff_expect\n> > @@ -303,7 +304,7 @@ test_expect_success 'redoing the last two\n> > commits should succeed' ' echo \"1st line 2nd file\" >secondfile &&\n> >  \techo \"2nd line 2nd file\" >>secondfile &&\n> >  \tgit commit -a -m \"modify 2nd file\" &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\tcheck_changes $head5\n> >  '\n> >  \n> >  >.diff_expect\n> > @@ -341,15 +342,15 @@ EOF\n> >  test_expect_success \\\n> >  \t'--hard reset to ORIG_HEAD should clear a fast-forward\n> > merge' ' git reset --hard HEAD^ &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\tcheck_changes $head5 &&\n> >  \n> >  \tgit pull . branch1 &&\n> >  \tgit reset --hard ORIG_HEAD &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&\n> > +\tcheck_changes $head5 &&\n> >  \n> >  \tgit checkout master &&\n> >  \tgit branch -D branch1 branch2 &&\n> > -\tcheck_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc\n> > +\tcheck_changes $head5\n> >  '\n> >  \n> >  cat > expect << EOF\n"},{"id":"207781","messageId":"20130125132028.1cd55df2@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7v38xqba04.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-25T09:20:28Z","receivedAt":"2013-01-25T09:20:28Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> > The expected SHA-1 digests are always available in variables.  Use\n> > them instead of hardcoding.\n> >\n> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> > ---\n> >  t/t6006-rev-list-format.sh | 130\n> > +++++++++++++++++++++++++-------------------- 1 file changed, 72\n> > insertions(+), 58 deletions(-)\n> >\n> > diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> > index f94f0c4..c248509 100755\n> > --- a/t/t6006-rev-list-format.sh\n> > +++ b/t/t6006-rev-list-format.sh\n> > @@ -6,8 +6,19 @@ test_description='git rev-list --pretty=format\n> > test' \n> >  test_tick\n> >  test_expect_success 'setup' '\n> > -touch foo && git add foo && git commit -m \"added foo\" &&\n> > -  echo changed >foo && git commit -a -m \"changed foo\"\n> > +\ttouch foo &&\n> \n> This is inherited from the original, but these days we try to avoid\n> touch, unless it is about setting a new file timestamp.  The\n> canonical (in the script we write) way to create an empty file is:\n> \n>     : >foo\n> \n> with or without \": \", it does not matter that much.\nOk!\n\n> \n> > +\tgit add foo &&\n> > +\tgit commit -m \"added foo\" &&\n> > +\thead1=$(git rev-parse --verify HEAD) &&\n> > +\thead1_7=$(echo $head1 | cut -c1-7) &&\n> \n> Why do we want \"whatever_7\" variables and use \"cut -c1-7\" to produce\n> them?  Is \"7\" something we care deeply about?\nI did not spend too much time to think of names of variables at the\nmoment I was writing this code )\n> \n> I think what we care a lot more than \"7\" that happens to be the\n> current default value is to make sure that, if we ever update the\n> default abbreviation length to a larger value, the abbreviation\n> shown with --format=%h is consistent with the abbreviation that is\n> given by rev-parse --short.\n> \n>     head1_short=$(git rev-parse --short $head1)\n> \n> perhaps?\nIt's an inherited code from 1.5 years ago Git ;) taken from some other\ntests\nI'll change it as you propose )\n\n> \n> > +\techo changed >foo &&\n> > +\tgit commit -a -m \"changed foo\" &&\n> > +\thead2=$(git rev-parse --verify HEAD) &&\n> > +\thead2_7=$(echo $head2 | cut -c1-7) &&\n> > +\thead2_parent=$(git cat-file -p HEAD | grep parent | cut -f\n> > 2 -d\" \") &&\n> \n> Do not use \"cat-file -p\" that is for human consumption in scripts,\n> unless you are testing how the format for human consumption should\n> look like (we may later add more pretty-print to them), which is not\n> the case here.\n> \n> Also be careful and pay attention to the end of the header; you do\n> not want to pick up a random \"parent\" string in the middle of a log\n> message.\n> \n>     head2_parent=$(git cat-file commit HEAD | sed -n -e\n> \"s/^parent //p\" -e \"/^$/q\")\n> \n> would be much better.\nyep! you're definitely right\n\n> \n> > +\thead2_parent_7=$(echo $head2_parent | cut -c1-7) &&\n> > +\ttree2=$(git cat-file -p HEAD | grep tree | cut -f 2 -d\" \")\n> > &&\n> \n> Likewise.\n> \n> > +\ttree2_7=$(echo $tree2 | cut -c1-7)\n> \n> Likewise.\n> \n> > @@ -131,39 +142,42 @@ This commit message is much longer than the\n> > others, and it will be encoded in iso8859-1. We should therefore\n> >  include an iso8859 character: ¡bueno!\n> >  EOF\n> > +\n> >  test_expect_success 'setup complex body' '\n> > -git config i18n.commitencoding iso8859-1 &&\n> > -  echo change2 >foo && git commit -a -F commit-msg\n> > +\tgit config i18n.commitencoding iso8859-1 &&\n> > +\techo change2 >foo && git commit -a -F commit-msg &&\n> > +\thead3=$(git rev-parse --verify HEAD) &&\n> > +\thead3_7=$(echo $head3 | cut -c1-7)\n> >  '\n> \n> Likewise.\n> \n> Thanks.\n"},{"id":"207802","messageId":"20130125150620.3b9dc9c3@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7v38xqba04.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-25T11:06:20Z","receivedAt":"2013-01-25T11:06:20Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Why do we want \"whatever_7\" variables and use \"cut -c1-7\" to produce\n> them?  Is \"7\" something we care deeply about?\n> \n> I think what we care a lot more than \"7\" that happens to be the\n> current default value is to make sure that, if we ever update the\n> default abbreviation length to a larger value, the abbreviation\n> shown with --format=%h is consistent with the abbreviation that is\n> given by rev-parse --short.\n> \n>     head1_short=$(git rev-parse --short $head1)\n> \n> perhaps?\n> \n> > +\techo changed >foo &&\n> > +\tgit commit -a -m \"changed foo\" &&\n> > +\thead2=$(git rev-parse --verify HEAD) &&\n> > +\thead2_7=$(echo $head2 | cut -c1-7) &&\n> > +\thead2_parent=$(git cat-file -p HEAD | grep parent | cut -f\n> > 2 -d\" \") &&\n> \n> Do not use \"cat-file -p\" that is for human consumption in scripts,\n> unless you are testing how the format for human consumption should\n> look like (we may later add more pretty-print to them), which is not\n> the case here.\n> \n> Also be careful and pay attention to the end of the header; you do\n> not want to pick up a random \"parent\" string in the middle of a log\n> message.\n> \n>     head2_parent=$(git cat-file commit HEAD | sed -n -e\n> \"s/^parent //p\" -e \"/^$/q\")\n> \n> would be much better.\n> \n> > +\thead2_parent_7=$(echo $head2_parent | cut -c1-7) &&\n> > +\ttree2=$(git cat-file -p HEAD | grep tree | cut -f 2 -d\" \")\n> > &&\n> \n> Likewise.\n> \n> > +\ttree2_7=$(echo $tree2 | cut -c1-7)\n> \n> Likewise.\nbut is there \"git something\" to return abbreviated tree hash except\n\"pretty formats\" that is implicitly tested here?\n"},{"id":"207813","messageId":"7vmwvx5m4o.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"20130125150620.3b9dc9c3@ashu.dyn1.rarus.ru","subject":"Re: [PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-25T15:16:07Z","receivedAt":"2013-01-25T15:16:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n>> Why do we want \"whatever_7\" variables and use \"cut -c1-7\" to produce\n>> them?  Is \"7\" something we care deeply about?\n>> \n>> I think what we care a lot more than \"7\" that happens to be the\n>> current default value is to make sure that, if we ever update the\n>> default abbreviation length to a larger value, the abbreviation\n>> shown with --format=%h is consistent with the abbreviation that is\n>> given by rev-parse --short.\n>> \n>>     head1_short=$(git rev-parse --short $head1)\n>> \n>> perhaps?\n>> ...\n>> Likewise.\n>> \n>> > +\ttree2_7=$(echo $tree2 | cut -c1-7)\n>> \n>> Likewise.\n> but is there \"git something\" to return abbreviated tree hash except\n> \"pretty formats\" that is implicitly tested here?\n\nDoes \"git rev-parse --short $tree2\" count?\n"},{"id":"207814","messageId":"20130125192708.291e62bc@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vmwvx5m4o.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-01-25T15:27:08Z","receivedAt":"2013-01-25T15:27:08Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> >> Why do we want \"whatever_7\" variables and use \"cut -c1-7\" to\n> >> produce them?  Is \"7\" something we care deeply about?\n> >> \n> >> I think what we care a lot more than \"7\" that happens to be the\n> >> current default value is to make sure that, if we ever update the\n> >> default abbreviation length to a larger value, the abbreviation\n> >> shown with --format=%h is consistent with the abbreviation that is\n> >> given by rev-parse --short.\n> >> \n> >>     head1_short=$(git rev-parse --short $head1)\n> >> \n> >> perhaps?\n> >> ...\n> >> Likewise.\n> >> \n> >> > +\ttree2_7=$(echo $tree2 | cut -c1-7)\n> >> \n> >> Likewise.\n> > but is there \"git something\" to return abbreviated tree hash except\n> > \"pretty formats\" that is implicitly tested here?\n> \n> Does \"git rev-parse --short $tree2\" count?\nOops! Yep!\n"},{"id":"221452","messageId":"cover.1371720245.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1359018188.git.Alex.Crezoff@gmail.com","subject":"[PATCH v5 0/5] Reroll patches against v1.8.3.1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-20T09:26:16Z","receivedAt":"2013-06-20T09:26:16Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Alexey Shumkin (5):\n  t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n  t7102 (reset): don't hardcode SHA-1 in expected outputs\n  t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n  pretty: Add failing tests: user format ignores i18n.logOutputEncoding\n    setting\n  pretty: user format ignores i18n.logOutputEncoding setting\n\n builtin/reset.c                  |   8 +-\n builtin/rev-list.c               |   1 +\n builtin/shortlog.c               |   1 +\n log-tree.c                       |   1 +\n submodule.c                      |   3 +\n t/t4041-diff-submodule-option.sh |  25 +++--\n t/t4205-log-pretty-formats.sh    | 179 ++++++++++++++++++++-------------\n t/t6006-rev-list-format.sh       | 209 ++++++++++++++++++++++++---------------\n t/t7102-reset.sh                 |  37 ++++++-\n 9 files changed, 299 insertions(+), 165 deletions(-)\n\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221453","messageId":"3aff7ccae2f7e8b1499b4e11a65c5815b06c1959.1371720245.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1371720245.git.Alex.Crezoff@gmail.com","subject":"[PATCH v5 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-20T09:26:17Z","receivedAt":"2013-06-20T09:26:17Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t6006-rev-list-format.sh | 142 +++++++++++++++++++++++++--------------------\n 1 file changed, 79 insertions(+), 63 deletions(-)\n\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 0393c9f..d32e65e 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -7,8 +7,21 @@ test_description='git rev-list --pretty=format test'\n \n test_tick\n test_expect_success 'setup' '\n-touch foo && git add foo && git commit -m \"added foo\" &&\n-  echo changed >foo && git commit -a -m \"changed foo\"\n+\t: >foo &&\n+\tgit add foo &&\n+\tgit commit -m \"added foo\" &&\n+\thead1=$(git rev-parse --verify HEAD) &&\n+\thead1_short=$(git rev-parse --short $head1) &&\n+\ttree1=$(git cat-file commit HEAD | sed -n -e \"s/^tree //p\" -e \"/^$/q\") &&\n+\ttree1_short=$(git rev-parse --short $tree1) &&\n+\techo changed >foo &&\n+\tgit commit -a -m \"changed foo\" &&\n+\thead2=$(git rev-parse --verify HEAD) &&\n+\thead2_short=$(git rev-parse --short $head2) &&\n+\thead2_parent=$(git cat-file commit HEAD | sed -n -e \"s/^parent //p\" -e \"/^$/q\") &&\n+\thead2_parent_short=$(git rev-parse --short $head2_parent) &&\n+\ttree2=$(git cat-file commit HEAD | sed -n -e \"s/^tree //p\" -e \"/^$/q\") &&\n+\ttree2_short=$(git rev-parse --short $tree2)\n '\n \n # usage: test_format name format_string <expected_output\n@@ -32,49 +45,49 @@ has_no_color () {\n \ttest_cmp expect \"$1\"\n }\n \n-test_format percent %%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format percent %%h <<EOF\n+commit $head2\n %h\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n %h\n EOF\n \n-test_format hash %H%n%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-131a310eb913d107dd3c09a65d1651175898735d\n-131a310\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n+test_format hash %H%n%h <<EOF\n+commit $head2\n+$head2\n+$head2_short\n+commit $head1\n+$head1\n+$head1_short\n EOF\n \n-test_format tree %T%n%t <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-fe722612f26da5064c32ca3843aa154bdb0b08a0\n-fe72261\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-4d5fcadc293a348e88f777dc0920f11e7d71441c\n-4d5fcad\n+test_format tree %T%n%t <<EOF\n+commit $head2\n+$tree2\n+$tree2_short\n+commit $head1\n+$tree1\n+$tree1_short\n EOF\n \n-test_format parents %P%n%p <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format parents %P%n%p <<EOF\n+commit $head2\n+$head1\n+$head2_parent_short\n+commit $head1\n \n \n EOF\n \n # we don't test relative here\n-test_format author %an%n%ae%n%ad%n%aD%n%at <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format author %an%n%ae%n%ad%n%aD%n%at <<EOF\n+commit $head2\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -82,14 +95,14 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<EOF\n+commit $head2\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -97,43 +110,43 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format encoding %e <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format encoding %e <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format subject %s <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format subject %s <<EOF\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format body %b <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format body %b <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format raw-body %B <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format raw-body %B <<EOF\n+commit $head2\n changed foo\n \n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n \n EOF\n \n-test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<EOF\n+commit $head2\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n EOF\n \n-test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<EOF\n+commit $head2\n \u001b[1;31;43mfoo\u001b[m\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[1;31;43mfoo\u001b[m\n EOF\n \n@@ -186,39 +199,42 @@ This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: �bueno!\n EOF\n+\n test_expect_success 'setup complex body' '\n-git config i18n.commitencoding iso8859-1 &&\n-  echo change2 >foo && git commit -a -F commit-msg\n+\tgit config i18n.commitencoding iso8859-1 &&\n+\techo change2 >foo && git commit -a -F commit-msg &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n+\thead3_short=$(git rev-parse --short $head3)\n '\n \n-test_format complex-encoding %e <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-encoding %e <<EOF\n+commit $head3\n iso8859-1\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n-test_format complex-subject %s <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-subject %s <<EOF\n+commit $head3\n Test printing of complex bodies\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format complex-body %b <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-body %b <<EOF\n+commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: �bueno!\n \n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n test_expect_success '%x00 shows NUL' '\n-\techo  >expect commit 1ed88da4a5b5ed8c449114ac131efc62178734c3 &&\n+\techo  >expect commit $head3 &&\n \techo >>expect fooQbar &&\n \tgit rev-list -1 --format=foo%x00bar HEAD >actual.nul &&\n \tnul_to_q <actual.nul >actual &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221454","messageId":"acdabc3dc47f543d519ab598ffef8df1fd91be7f.1371720245.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1371720245.git.Alex.Crezoff@gmail.com","subject":"[PATCH v5 2/5] t7102 (reset): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-20T09:26:18Z","receivedAt":"2013-06-20T09:26:18Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t7102-reset.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex df82ec9..05dfb27 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -192,7 +192,8 @@ test_expect_success \\\n \t'changing files and redo the last commit should succeed' '\n \techo \"3rd line 2nd file\" >>secondfile &&\n \tgit commit -a -C ORIG_HEAD &&\n-\tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n+\thead4=$(git rev-parse --verify HEAD) &&\n+\tcheck_changes $head4 &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n \t\t\t$head5\n '\n@@ -211,7 +212,7 @@ test_expect_success \\\n \tgit reset --hard HEAD~2 &&\n \tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n-\t\t\t3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d\n+\t\t\t$head4\n '\n \n >.diff_expect\n@@ -326,10 +327,11 @@ test_expect_success '--hard reset to HEAD should clear a failed merge' '\n \tgit checkout branch2 &&\n \techo \"3rd line in branch2\" >>secondfile &&\n \tgit commit -a -m \"change in branch2\" &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n \n \ttest_must_fail git pull . branch1 &&\n \tgit reset --hard &&\n-\tcheck_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb\n+\tcheck_changes $head3\n '\n \n >.diff_expect\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221455","messageId":"8ca30465721ee9f98613397c1778640e3fcc0f83.1371720245.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1371720245.git.Alex.Crezoff@gmail.com","subject":"[PATCH v5 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-20T09:26:19Z","receivedAt":"2013-06-20T09:26:19Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 48 +++++++++++++++++++++++--------------------\n 1 file changed, 26 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 26fbfde..6d8d457 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '\n \n test_expect_success 'setup more commits' '\n \ttest_commit \"message one\" one one message-one &&\n-\ttest_commit \"message two\" two two message-two\n+\ttest_commit \"message two\" two two message-two &&\n+\thead1=$(git rev-list --max-count=1 --abbrev-commit HEAD~0) &&\n+\thead2=$(git rev-list --max-count=1 --abbrev-commit HEAD~1) &&\n+\thead3=$(git rev-list --max-count=1 --abbrev-commit HEAD~2) &&\n+\thead4=$(git rev-list --max-count=1 --abbrev-commit HEAD~3)\n '\n \n test_expect_success 'left alignment formatting' '\n@@ -117,18 +121,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %<|(40)%s\" >actual &&\n+test_expect_success 'left alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1 message two                    Z\n-7cd6c63 message one                    Z\n-1711bf9 add bar                        Z\n-af20c06 initial                        Z\n+$head1 message two                    Z\n+$head2 message one                    Z\n+$head3 add bar                        Z\n+$head4 initial                        Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'left alignment formatting with no padding' '\n \tgit log --pretty=\"format:%<(1)%s\" >actual &&\n@@ -195,18 +199,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'right alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %>|(40)%s\" >actual &&\n+test_expect_success 'right alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1                      message two\n-7cd6c63                      message one\n-1711bf9                          add bar\n-af20c06                          initial\n+$head1                      message two\n+$head2                      message one\n+$head3                          add bar\n+$head4                          initial\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'right alignment formatting with no padding' '\n \tgit log --pretty=\"format:%>(1)%s\" >actual &&\n@@ -234,18 +238,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'center alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %><|(40)%s\" >actual &&\n+test_expect_success 'center alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1           message two          Z\n-7cd6c63           message one          Z\n-1711bf9             add bar            Z\n-af20c06             initial            Z\n+$head1           message two          Z\n+$head2           message one          Z\n+$head3             add bar            Z\n+$head4             initial            Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'center alignment formatting with no padding' '\n \tgit log --pretty=\"format:%><(1)%s\" >actual &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221456","messageId":"297a5bacde1eb3cbe96a05e8ddf1783c44cba4ac.1371720245.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1371720245.git.Alex.Crezoff@gmail.com","subject":"[PATCH v5 4/5] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-20T09:26:20Z","receivedAt":"2013-06-20T09:26:20Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The following two commands are expected to give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it format \"%s\".\nLog messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted with the latter even\nwhen i18n.logOutputEncoding and terminal encoding are the same.\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |  35 +++++----\n t/t4205-log-pretty-formats.sh    | 149 ++++++++++++++++++++++++---------------\n t/t6006-rev-list-format.sh       |  85 +++++++++++++++-------\n t/t7102-reset.sh                 |  29 +++++++-\n 4 files changed, 200 insertions(+), 98 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 32d4a60..22bf4df 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -1,6 +1,7 @@\n #!/bin/sh\n #\n # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Support for verbose submodule differences in git diff\n@@ -10,6 +11,9 @@ This test tries to verify the sanity of the --submodule option of git diff.\n \n . ./test-lib.sh\n \n+# String \"added\" in Russian, encoded in UTF-8, used in\n+# sample commit log messages in add_file() function below.\n+added=$(printf \"\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275\")\n add_file () {\n \t(\n \t\tcd \"$1\" &&\n@@ -19,7 +23,8 @@ add_file () {\n \t\t\techo \"$name\" >\"$name\" &&\n \t\t\tgit add \"$name\" &&\n \t\t\ttest_tick &&\n-\t\t\tgit commit -m \"Add $name\" || exit\n+\t\t\tmsg_added_iso88595=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso88595) &&\n+\t\t\tgit -c 'i18n.commitEncoding=iso88595' commit -m \"$msg_added_iso88595\"\n \t\tdone >/dev/null &&\n \t\tgit rev-parse --short --verify HEAD\n \t)\n@@ -89,29 +94,29 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward) --submodule' '\n+test_expect_failure 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n@@ -138,25 +143,25 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_success 'modified submodule(backward)' '\n+test_expect_failure 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_success 'modified submodule(backward and forward)' '\n+test_expect_failure 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\n-\t  > Add foo5\n-\t  > Add foo4\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  > Add foo5 ($added foo5)\n+\t  > Add foo4 ($added foo4)\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 6d8d457..6a56019 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -1,20 +1,43 @@\n #!/bin/sh\n #\n # Copyright (c) 2010, Will Palmer\n+# Copyright (c) 2011, Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+commit_msg() {\n+\t# String \"initial commit\" partly in Russian, encoded in UTF-8,\n+\t# used as a commit log message below.\n+\tmsg=$(printf \"initial \\320\\272\\320\\276\\320\\274\\320\\274\\320\\270\\321\\202\")\n+\tif test -n \"$1\"\n+\tthen\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\tif test -n \"$2\" -a -n \"$3\"\n+\tthen\n+\t\t# cut string, replace cut part with two dots\n+\t\t# $2 - chars count from the beginning of the string\n+\t\t# $3 - \"trailing\" chars\n+\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n+\t\t# as it does with C locale\n+\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'set up basic repos' '\n \t>foo &&\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit commit -m initial &&\n+\tgit config i18n.commitEncoding iso88595 &&\n+\tgit commit -m \"$(commit_msg iso88595)\" &&\n \tgit add bar &&\n \ttest_tick &&\n-\tgit commit -m \"add bar\"\n+\tgit commit -m \"add bar\" &&\n+\tgit config --unset i18n.commitEncoding\n '\n \n test_expect_success 'alias builtin format' '\n@@ -38,6 +61,20 @@ test_expect_success 'alias user-defined format' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'alias user-defined tformat with %s (iso88595 encoding)' '\n+\tgit config i18n.logOutputEncoding iso88595 &&\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\tgit config --unset i18n.logOutputEncoding &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n+test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n test_expect_success 'alias user-defined tformat' '\n \tgit log --pretty=\"tformat:%h\" >expected &&\n \tgit config pretty.test-alias \"tformat:%h\" &&\n@@ -71,22 +108,22 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_success 'NUL separation' '\n-\tprintf \"add bar\\0initial\" >expected &&\n+test_expect_failure 'NUL separation' '\n+\tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL termination' '\n-\tprintf \"add bar\\0initial\\0\" >expected &&\n+test_expect_failure 'NUL termination' '\n+\tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL separation with --stat' '\n+test_expect_failure 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n \tgit log -z --stat --pretty=\"format:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -94,7 +131,7 @@ test_expect_success 'NUL separation with --stat' '\n test_expect_failure 'NUL termination with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\\0\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n0\" >expected &&\n \tgit log -z --stat --pretty=\"tformat:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -108,20 +145,20 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-list --max-count=1 --abbrev-commit HEAD~3)\n '\n \n-test_expect_success 'left alignment formatting' '\n-\tgit log --pretty=\"format:%<(40)%s\" >actual &&\n+test_expect_failure 'left alignment formatting' \"\n+\tgit log --pretty='format:%<(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n message two                            Z\n message one                            Z\n add bar                                Z\n-initial                                Z\n+$(commit_msg)                         Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting at the nth column' \"\n+test_expect_failure 'left alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -129,77 +166,77 @@ test_expect_success 'left alignment formatting at the nth column' \"\n $head1 message two                    Z\n $head2 message one                    Z\n $head3 add bar                        Z\n-$head4 initial                        Z\n+$head4 $(commit_msg)                 Z\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'left alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%<(1)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with no padding' \"\n+\tgit log --pretty='format:%<(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with trunc' '\n-\tgit log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with trunc' \"\n+\tgit log --pretty='format:%<(10,trunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n message ..\n message ..\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"8\" \".\\+$\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with ltrunc' '\n-\tgit log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with ltrunc' \"\n+\tgit log --pretty='format:%<(10,ltrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n ..sage two\n ..sage one\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"0\" \".\\{6\\}\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with mtrunc' '\n-\tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with mtrunc' \"\n+\tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n mess.. two\n mess.. one\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"4\" \".\\{6\\}\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'right alignment formatting' '\n-\tgit log --pretty=\"format:%>(40)%s\" >actual &&\n+test_expect_failure 'right alignment formatting' \"\n+\tgit log --pretty='format:%>(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n Z                            message two\n Z                            message one\n Z                                add bar\n-Z                                initial\n+Z                         $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'right alignment formatting at the nth column' \"\n+test_expect_failure 'right alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -207,38 +244,38 @@ test_expect_success 'right alignment formatting at the nth column' \"\n $head1                      message two\n $head2                      message one\n $head3                          add bar\n-$head4                          initial\n+$head4                   $(commit_msg)\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'right alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%>(1)%s\" >actual &&\n+test_expect_failure 'right alignment formatting with no padding' \"\n+\tgit log --pretty='format:%>(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'center alignment formatting' '\n-\tgit log --pretty=\"format:%><(40)%s\" >actual &&\n+test_expect_failure 'center alignment formatting' \"\n+\tgit log --pretty='format:%><(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n Z             message two              Z\n Z             message one              Z\n Z               add bar                Z\n-Z               initial                Z\n+Z            $(commit_msg)            Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'center alignment formatting at the nth column' \"\n+test_expect_failure 'center alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -246,36 +283,36 @@ test_expect_success 'center alignment formatting at the nth column' \"\n $head1           message two          Z\n $head2           message one          Z\n $head3             add bar            Z\n-$head4             initial            Z\n+$head4          $(commit_msg)        Z\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'center alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%><(1)%s\" >actual &&\n+test_expect_failure 'center alignment formatting with no padding' \"\n+\tgit log --pretty='format:%><(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left/right alignment formatting with stealing' '\n-\tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n-\tgit log --pretty=\"format:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n+test_expect_failure 'left/right alignment formatting with stealing' \"\n+\tgit commit --amend -m short --author 'long long long <long@me.com>' &&\n+\tgit log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n-initial      A U Thor\n+$(commit_msg \"\" \"8\" \".\\+$\")   A U Thor\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_done\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex d32e65e..36e4cc0 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -1,36 +1,62 @@\n #!/bin/sh\n \n+# Copyright (c) 2009 Jens Lehmann\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n+\n test_description='git rev-list --pretty=format test'\n \n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-terminal.sh\n \n test_tick\n+# String \"added\" in Russian, encoded in UTF-8,\n+# used as a commit log message below.\n+added=$(printf \"added (\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275) foo\")\n+added_iso88595=$(echo \"$added\" | iconv -f utf-8 -t iso88595)\n+# same but \"changed\"\n+changed=$(printf \"changed (\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275) foo\")\n+changed_iso88595=$(echo \"$changed\" | iconv -f utf-8 -t iso88595)\n+\n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n-\tgit commit -m \"added foo\" &&\n+\tgit config i18n.commitEncoding iso88595 &&\n+\tgit commit -m \"$added_iso88595\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_short=$(git rev-parse --short $head1) &&\n \ttree1=$(git cat-file commit HEAD | sed -n -e \"s/^tree //p\" -e \"/^$/q\") &&\n \ttree1_short=$(git rev-parse --short $tree1) &&\n-\techo changed >foo &&\n-\tgit commit -a -m \"changed foo\" &&\n+\techo \"$changed\" > foo &&\n+\tgit commit -a -m \"$changed_iso88595\" &&\n \thead2=$(git rev-parse --verify HEAD) &&\n \thead2_short=$(git rev-parse --short $head2) &&\n \thead2_parent=$(git cat-file commit HEAD | sed -n -e \"s/^parent //p\" -e \"/^$/q\") &&\n \thead2_parent_short=$(git rev-parse --short $head2_parent) &&\n \ttree2=$(git cat-file commit HEAD | sed -n -e \"s/^tree //p\" -e \"/^$/q\") &&\n-\ttree2_short=$(git rev-parse --short $tree2)\n+\ttree2_short=$(git rev-parse --short $tree2) &&\n+\tgit config --unset i18n.commitEncoding\n '\n \n-# usage: test_format name format_string <expected_output\n+# usage: test_format [failure] name format_string <expected_output\n test_format () {\n+\tlocal must_fail=0\n+\t# if parameters count is more than 2 then test must fail\n+\tif test $# -gt 2\n+\tthen\n+\t\tmust_fail=1\n+\t\t# remove first parameter which is flag for test failure\n+\t\tshift\n+\tfi\n \tcat >expect.$1\n-\ttest_expect_success \"format $1\" \"\n-\t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n-\t\ttest_cmp expect.$1 output.$1\n-\t\"\n+\tname=\"format $1\"\n+\tcommand=\"git rev-list --pretty=format:'$2' master >output.$1 &&\n+\t\ttest_cmp expect.$1 output.$1\"\n+\tif test $must_fail -eq 1\n+\tthen\n+\t\ttest_expect_failure \"$name\" \"$command\"\n+\telse\n+\t\ttest_expect_success \"$name\" \"$command\"\n+\tfi\n }\n \n # Feed to --format to provide predictable colored sequences.\n@@ -112,14 +138,16 @@ EOF\n \n test_format encoding %e <<EOF\n commit $head2\n+iso88595\n commit $head1\n+iso88595\n EOF\n \n-test_format subject %s <<EOF\n+test_format failure subject %s <<EOF\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n test_format body %b <<EOF\n@@ -127,12 +155,12 @@ commit $head2\n commit $head1\n EOF\n \n-test_format raw-body %B <<EOF\n+test_format failure raw-body %B <<EOF\n commit $head2\n-changed foo\n+$changed\n \n commit $head1\n-added foo\n+$added\n \n EOF\n \n@@ -192,42 +220,49 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '\n \t)\n '\n \n-cat >commit-msg <<'EOF'\n+iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF\n Test printing of complex bodies\n \n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: �bueno!\n+include an iso8859 character: ¡bueno!\n EOF\n \n test_expect_success 'setup complex body' '\n \tgit config i18n.commitencoding iso8859-1 &&\n \techo change2 >foo && git commit -a -F commit-msg &&\n \thead3=$(git rev-parse --verify HEAD) &&\n-\thead3_short=$(git rev-parse --short $head3)\n+\thead3_short=$(git rev-parse --short $head3) &&\n+\t# unset commit encoding config\n+\t# otherwise %e does not print encoding value\n+\t# and following test fails\n+\tgit config --unset i18n.commitEncoding\n+\n '\n \n test_format complex-encoding %e <<EOF\n commit $head3\n iso8859-1\n commit $head2\n+iso88595\n commit $head1\n+iso88595\n EOF\n \n-test_format complex-subject %s <<EOF\n+test_format failure complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n-test_format complex-body %b <<EOF\n+test_format failure complex-body %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: �bueno!\n+include an iso8859 character: ¡bueno!\n \n commit $head2\n commit $head1\n@@ -281,12 +316,12 @@ test_expect_success 'add LF before non-empty (2)' '\n \n test_expect_success 'add SP before non-empty (1)' '\n \tgit show -s --pretty=format:\"%s% bThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 2\n+\ttest $(wc -w <actual) = 3\n '\n \n test_expect_success 'add SP before non-empty (2)' '\n \tgit show -s --pretty=format:\"%s% sThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 4\n+\ttest $(wc -w <actual) = 6\n '\n \n test_expect_success '--abbrev' '\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 05dfb27..48534f1 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -9,6 +9,17 @@ Documented tests for git reset'\n \n . ./test-lib.sh\n \n+commit_msg() {\n+\t# String \"2nd file modified\" in Russian, encoded in UTF-8,\n+\t# used as a commit log message below.\n+\tmsg=$(printf \"modify 2nd file (\\320\\270\\320\\267\\320\\274\\320\\265\\320\\275\\321\\221\\320\\275 \\321\\204\\320\\260\\320\\271\\320\\273)\")\n+\tif test -n \"$1\"\n+\tthen\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'creating initial files and commits' '\n \ttest_tick &&\n \techo \"1st file\" >first &&\n@@ -28,7 +39,7 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=iso88595\" commit -a -m \"$(commit_msg iso88595)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -44,6 +55,20 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n+test_expect_failure 'reset --hard message' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg) > .expected &&\n+\ttest_cmp .expected .actual\n+'\n+\n+test_expect_success 'reset --hard message (iso88595 logoutencoding)' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit -c \"i18n.logOutputEncoding=iso88595\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg iso88595) > .expected &&\n+\ttest_cmp .expected .actual\n+'\n+\n >.diff_expect\n >.cached_expect\n cat >.cat_expect <<EOF\n@@ -304,7 +329,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=iso88595\" commit -a -m \"$(commit_msg iso88595)\" &&\n \tcheck_changes $head5\n '\n \n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221457","messageId":"ed75c8cbcfbbac336e2384e2f566e42264154918.1371720245.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1371720245.git.Alex.Crezoff@gmail.com","subject":"[PATCH v5 5/5] pretty: user format ignores i18n.logOutputEncoding setting","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-20T09:26:21Z","receivedAt":"2013-06-20T09:26:21Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The following two commands are expected to give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it format \"%s\".\nLog messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted with the latter even\nwhen i18n.logOutputEncoding and terminal encoding are the same.\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n builtin/reset.c                  |  8 ++++++--\n builtin/rev-list.c               |  1 +\n builtin/shortlog.c               |  1 +\n log-tree.c                       |  1 +\n submodule.c                      |  3 +++\n t/t4041-diff-submodule-option.sh | 10 +++++-----\n t/t4205-log-pretty-formats.sh    | 34 +++++++++++++++++-----------------\n t/t6006-rev-list-format.sh       |  8 ++++----\n t/t7102-reset.sh                 |  2 +-\n 9 files changed, 39 insertions(+), 29 deletions(-)\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 6032131..b23ed63 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -92,11 +92,15 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet)\n \n static void print_new_head_line(struct commit *commit)\n {\n-\tconst char *hex, *body;\n+\tconst char *hex, *body, *encoding;\n \n \thex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);\n \tprintf(_(\"HEAD is now at %s\"), hex);\n-\tbody = strstr(commit->buffer, \"\\n\\n\");\n+\tencoding = get_log_output_encoding();\n+\tbody = logmsg_reencode(commit, NULL, encoding);\n+\tif (!body)\n+\t\tbody = commit->buffer;\n+\tbody = strstr(body, \"\\n\\n\");\n \tif (body) {\n \t\tconst char *eol;\n \t\tsize_t len;\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 67701be..a5ec30d 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -111,6 +111,7 @@ static void show_commit(struct commit *commit, void *data)\n \t\tctx.date_mode = revs->date_mode;\n \t\tctx.date_mode_explicit = revs->date_mode_explicit;\n \t\tctx.fmt = revs->commit_format;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &buf);\n \t\tif (revs->graph) {\n \t\t\tif (buf.len) {\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 1fd6f8a..1434f8f 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -137,6 +137,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n \t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &ufbuf);\n \t\tbuffer = ufbuf.buf;\n \t} else if (*buffer) {\ndiff --git a/log-tree.c b/log-tree.c\nindex 1946e9c..5277d3e 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -616,6 +616,7 @@ void show_log(struct rev_info *opt)\n \tctx.fmt = opt->commit_format;\n \tctx.mailmap = opt->mailmap;\n \tctx.color = opt->diffopt.use_color;\n+\tctx.output_encoding = get_log_output_encoding();\n \tpretty_print_commit(&ctx, commit, &msgbuf);\n \n \tif (opt->add_signoff)\ndiff --git a/submodule.c b/submodule.c\nindex 1821a5b..baa8669 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -222,10 +222,13 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,\n \tstatic const char format[] = \"  %m %s\";\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct commit *commit;\n+\tconst char *log_output_encoding;\n \n+\tlog_output_encoding = get_log_output_encoding();\n \twhile ((commit = get_revision(rev))) {\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode = rev->date_mode;\n+\t\tctx.output_encoding = log_output_encoding;\n \t\tstrbuf_setlen(&sb, 0);\n \t\tstrbuf_addstr(&sb, line_prefix);\n \t\tif (commit->object.flags & SYMMETRIC_LEFT) {\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 22bf4df..ce192b0 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -94,7 +94,7 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -103,7 +103,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -112,7 +112,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward) --submodule' '\n+test_expect_success 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -143,7 +143,7 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_failure 'modified submodule(backward)' '\n+test_expect_success 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n@@ -154,7 +154,7 @@ test_expect_failure 'modified submodule(backward)' '\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_failure 'modified submodule(backward and forward)' '\n+test_expect_success 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 6a56019..1739a86 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -69,7 +69,7 @@ test_expect_success 'alias user-defined tformat with %s (iso88595 encoding)' '\n \ttest_cmp expected-s actual-s\n '\n \n-test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+test_expect_success 'alias user-defined tformat with %s (utf-8 encoding)' '\n \tgit log --oneline >expected-s &&\n \tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n \ttest_cmp expected-s actual-s\n@@ -108,19 +108,19 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_failure 'NUL separation' '\n+test_expect_success 'NUL separation' '\n \tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL termination' '\n+test_expect_success 'NUL termination' '\n \tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL separation with --stat' '\n+test_expect_success 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n \tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n@@ -145,7 +145,7 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-list --max-count=1 --abbrev-commit HEAD~3)\n '\n \n-test_expect_failure 'left alignment formatting' \"\n+test_expect_success 'left alignment formatting' \"\n \tgit log --pretty='format:%<(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -158,7 +158,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting at the nth column' \"\n+test_expect_success 'left alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -171,7 +171,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with no padding' \"\n+test_expect_success 'left alignment formatting with no padding' \"\n \tgit log --pretty='format:%<(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -184,7 +184,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with trunc' \"\n+test_expect_success 'left alignment formatting with trunc' \"\n \tgit log --pretty='format:%<(10,trunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -197,7 +197,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with ltrunc' \"\n+test_expect_success 'left alignment formatting with ltrunc' \"\n \tgit log --pretty='format:%<(10,ltrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -210,7 +210,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with mtrunc' \"\n+test_expect_success 'left alignment formatting with mtrunc' \"\n \tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -223,7 +223,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting' \"\n+test_expect_success 'right alignment formatting' \"\n \tgit log --pretty='format:%>(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -236,7 +236,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting at the nth column' \"\n+test_expect_success 'right alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -249,7 +249,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting with no padding' \"\n+test_expect_success 'right alignment formatting with no padding' \"\n \tgit log --pretty='format:%>(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -262,7 +262,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting' \"\n+test_expect_success 'center alignment formatting' \"\n \tgit log --pretty='format:%><(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -275,7 +275,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting at the nth column' \"\n+test_expect_success 'center alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -288,7 +288,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting with no padding' \"\n+test_expect_success 'center alignment formatting with no padding' \"\n \tgit log --pretty='format:%><(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -301,7 +301,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left/right alignment formatting with stealing' \"\n+test_expect_success 'left/right alignment formatting with stealing' \"\n \tgit commit --amend -m short --author 'long long long <long@me.com>' &&\n \tgit log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&\n \t# complete the incomplete line at the end\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 36e4cc0..055655c 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -143,7 +143,7 @@ commit $head1\n iso88595\n EOF\n \n-test_format failure subject %s <<EOF\n+test_format subject %s <<EOF\n commit $head2\n $changed\n commit $head1\n@@ -155,7 +155,7 @@ commit $head2\n commit $head1\n EOF\n \n-test_format failure raw-body %B <<EOF\n+test_format raw-body %B <<EOF\n commit $head2\n $changed\n \n@@ -249,7 +249,7 @@ commit $head1\n iso88595\n EOF\n \n-test_format failure complex-subject %s <<EOF\n+test_format complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n@@ -258,7 +258,7 @@ commit $head1\n $added\n EOF\n \n-test_format failure complex-body %b <<EOF\n+test_format complex-body %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 48534f1..5a7b383 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -55,7 +55,7 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n-test_expect_failure 'reset --hard message' '\n+test_expect_success 'reset --hard message' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg) > .expected &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221510","messageId":"7vppvgsfvq.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"cover.1371720245.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v5 0/5] Reroll patches against v1.8.3.1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-20T20:10:01Z","receivedAt":"2013-06-20T20:10:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n\n> Alexey Shumkin (5):\n>   t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n>   t7102 (reset): don't hardcode SHA-1 in expected outputs\n>   t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n>   pretty: Add failing tests: user format ignores i18n.logOutputEncoding\n>     setting\n>   pretty: user format ignores i18n.logOutputEncoding setting\n\nNext time, please jog readers' memory better by giving a bit more\ndescriptive cover letter.  \"Reroll\" is known by \"v5\" alrady, and\n\"against v1.8.3.1\" certainly helps, but what this series is about is\nunclear, especially because the end-game patch \"user format ignores\"\nis rather badly stated.  It is unclear if it is a good thing that\nuser format ignores it and the patch makes sure that is the case, if\nwe currently ignore it in user format and the patch fixes it by\nmaking user format pay attention to it, etc.\n\nThanks.\n\n>  builtin/reset.c                  |   8 +-\n>  builtin/rev-list.c               |   1 +\n>  builtin/shortlog.c               |   1 +\n>  log-tree.c                       |   1 +\n>  submodule.c                      |   3 +\n>  t/t4041-diff-submodule-option.sh |  25 +++--\n>  t/t4205-log-pretty-formats.sh    | 179 ++++++++++++++++++++-------------\n>  t/t6006-rev-list-format.sh       | 209 ++++++++++++++++++++++++---------------\n>  t/t7102-reset.sh                 |  37 ++++++-\n>  9 files changed, 299 insertions(+), 165 deletions(-)\n"},{"id":"221513","messageId":"7vd2rgsf93.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"297a5bacde1eb3cbe96a05e8ddf1783c44cba4ac.1371720245.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v5 4/5] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-20T20:23:36Z","receivedAt":"2013-06-20T20:23:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n\n> @@ -19,7 +23,8 @@ add_file () {\n>  \t\t\techo \"$name\" >\"$name\" &&\n>  \t\t\tgit add \"$name\" &&\n>  \t\t\ttest_tick &&\n> -\t\t\tgit commit -m \"Add $name\" || exit\n> +\t\t\tmsg_added_iso88595=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso88595) &&\n> +\t\t\tgit -c 'i18n.commitEncoding=iso88595' commit -m \"$msg_added_iso88595\"\n\nHmph.  Do we know 8859-5 is available or do these need to be\nprotected with prereq?\n\nCan these tests be done with 8859-1 i.e. something we already depend\non, by changing that $added message to latin-1, or is there something\nvery Russian specific breakage we want to test here?\n\nIf the former, please redo this entire patch (not just t4041) with\n8859-1.\n\nIf there is some Russian specific breakage you cannot demonstrate\nwith 8859-1, then please explain it in the log message.\n\n> diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> index d32e65e..36e4cc0 100755\n> --- a/t/t6006-rev-list-format.sh\n> +++ b/t/t6006-rev-list-format.sh\n> ...\n> -# usage: test_format name format_string <expected_output\n> +# usage: test_format [failure] name format_string <expected_output\n>  test_format () {\n> +\tlocal must_fail=0\n\nThis breaks tests for non-bash users.  \"local\" is not even in POSIX.\n"},{"id":"221514","messageId":"7v8v24selt.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"ed75c8cbcfbbac336e2384e2f566e42264154918.1371720245.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v5 5/5] pretty: user format ignores i18n.logOutputEncoding setting","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-20T20:37:34Z","receivedAt":"2013-06-20T20:37:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n\nSubject: Re: [PATCH v5 5/5] pretty: user format ignores i18n.logOutputEncoding setting\n\nThat is a statement of fact, and does not tell much to the reader.\n\nI think you are saying that in the current implementation,\nlogoutputencoding is not honored in user format, that it is a bug\nthat needs to be fixed (as opposed to \"that is by design, the\nscripts that read from --format='' is responsible for doing the\nconversion\"), and that this patch fixes it.\n\nSo\n\n\tpretty: --format output should honor logOutputEncoding\n\nor something?  At least it says what is the _desired_ outcome with\n\"should\", hints that the status-quo is different from that desired\noutcome and implies that this is a patch to fix it.\n\nThe \"Subject\" line is very important as that is the only thing we\nsee in many summarizing output format, e.g. shortlog, cover letter\nand merge message.\n\n> The following two commands are expected to give the same output to a terminal:\n>\n> \t$ git log --oneline --no-color\n> \t$ git log --pretty=format:'%h %s'\n>\n> However, the former pays attention to i18n.logOutputEncoding\n> configuration, while the latter does not when it format \"%s\".\n> Log messages written in an encoding i18n.commitEncoding which differs\n> from terminal encoding are shown corrupted with the latter even\n> when i18n.logOutputEncoding and terminal encoding are the same.\n>\n> The same corruption is true for\n> \t$ git diff --submodule=log\n> and\n> \t$ git rev-list --pretty=format:%s HEAD\n> and\n> \t$ git reset --hard\n>\n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> ---\n>  builtin/reset.c                  |  8 ++++++--\n>  builtin/rev-list.c               |  1 +\n>  builtin/shortlog.c               |  1 +\n>  log-tree.c                       |  1 +\n>  submodule.c                      |  3 +++\n>  t/t4041-diff-submodule-option.sh | 10 +++++-----\n>  t/t4205-log-pretty-formats.sh    | 34 +++++++++++++++++-----------------\n>  t/t6006-rev-list-format.sh       |  8 ++++----\n>  t/t7102-reset.sh                 |  2 +-\n>  9 files changed, 39 insertions(+), 29 deletions(-)\n>\n> diff --git a/builtin/reset.c b/builtin/reset.c\n> index 6032131..b23ed63 100644\n> --- a/builtin/reset.c\n> +++ b/builtin/reset.c\n> @@ -92,11 +92,15 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet)\n>  \n>  static void print_new_head_line(struct commit *commit)\n>  {\n> -\tconst char *hex, *body;\n> +\tconst char *hex, *body, *encoding;\n>  \n>  \thex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);\n>  \tprintf(_(\"HEAD is now at %s\"), hex);\n> -\tbody = strstr(commit->buffer, \"\\n\\n\");\n> +\tencoding = get_log_output_encoding();\n> +\tbody = logmsg_reencode(commit, NULL, encoding);\n\n\n> +\tif (!body)\n> +\t\tbody = commit->buffer;\n\nDoes this happen?  I thought body, without an error, can be the same\nas commit->buffer.\n\n> +\tbody = strstr(body, \"\\n\\n\");\n>  \tif (body) {\n>  \t\tconst char *eol;\n>  \t\tsize_t len;\n\nDo we have a leak here?  body may point at a new piece of memory\nlogmsg_reencode() have allocated to hold the UTF-8 version of your\n8859-5 message in commit->buffer.\n\nIt would be more like this, no?\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 6032131..8d22ffe 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -92,11 +92,13 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet)\n \n static void print_new_head_line(struct commit *commit)\n {\n-\tconst char *hex, *body;\n+\tconst char *hex, *body, *msg, *encoding; \n \n \thex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);\n \tprintf(_(\"HEAD is now at %s\"), hex);\n-\tbody = strstr(commit->buffer, \"\\n\\n\");\n+\n+\tmsg = logmsg_reencode(commit, NULL, get_log_output_encoding());\n+\tbody = strstr(msg, \"\\n\\n\");\n \tif (body) {\n \t\tconst char *eol;\n \t\tsize_t len;\n@@ -107,6 +109,7 @@ static void print_new_head_line(struct commit *commit)\n \t}\n \telse\n \t\tprintf(\"\\n\");\n+\tlogmsg_free(msg, commit);\n }\n \n static void update_index_from_diff(struct diff_queue_struct *q,\n"},{"id":"221515","messageId":"7v1u7wseku.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"3aff7ccae2f7e8b1499b4e11a65c5815b06c1959.1371720245.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v5 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-20T20:38:09Z","receivedAt":"2013-06-20T20:38:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n\n> The expected SHA-1 digests are always available in variables. Use\n> them instead of hardcoding.\n>\n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> ---\n>  t/t6006-rev-list-format.sh | 142 +++++++++++++++++++++++++--------------------\n>  1 file changed, 79 insertions(+), 63 deletions(-)\n>\n> diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> index 0393c9f..d32e65e 100755\n> --- a/t/t6006-rev-list-format.sh\n> +++ b/t/t6006-rev-list-format.sh\n> @@ -7,8 +7,21 @@ test_description='git rev-list --pretty=format test'\n>  \n>  test_tick\n>  test_expect_success 'setup' '\n> -touch foo && git add foo && git commit -m \"added foo\" &&\n> -  echo changed >foo && git commit -a -m \"changed foo\"\n> +\t: >foo &&\n> +\tgit add foo &&\n> +\tgit commit -m \"added foo\" &&\n> +\thead1=$(git rev-parse --verify HEAD) &&\n> +\thead1_short=$(git rev-parse --short $head1) &&\n> +\ttree1=$(git cat-file commit HEAD | sed -n -e \"s/^tree //p\" -e \"/^$/q\") &&\n> +\ttree1_short=$(git rev-parse --short $tree1) &&\n> +\techo changed >foo &&\n> +\tgit commit -a -m \"changed foo\" &&\n> +\thead2=$(git rev-parse --verify HEAD) &&\n> +\thead2_short=$(git rev-parse --short $head2) &&\n> +\thead2_parent=$(git cat-file commit HEAD | sed -n -e \"s/^parent //p\" -e \"/^$/q\") &&\n> +\thead2_parent_short=$(git rev-parse --short $head2_parent) &&\n> +\ttree2=$(git cat-file commit HEAD | sed -n -e \"s/^tree //p\" -e \"/^$/q\") &&\n\nWith modern Git, you can (and would) write this as\n\n\ttree2=$(git rev-parse HEAD:)\n\n(the same for tree1).  Other than that, looks sensible.\n\nWill queue with a tweak.\n"},{"id":"221516","messageId":"7vtxksr009.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"8ca30465721ee9f98613397c1778640e3fcc0f83.1371720245.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v5 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-20T20:38:14Z","receivedAt":"2013-06-20T20:38:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n\n> The expected SHA-1 digests are always available in variables. Use\n> them instead of hardcoding.\n>\n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> ---\n>  t/t4205-log-pretty-formats.sh | 48 +++++++++++++++++++++++--------------------\n>  1 file changed, 26 insertions(+), 22 deletions(-)\n>\n> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> index 26fbfde..6d8d457 100755\n> --- a/t/t4205-log-pretty-formats.sh\n> +++ b/t/t4205-log-pretty-formats.sh\n> @@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '\n>  \n>  test_expect_success 'setup more commits' '\n>  \ttest_commit \"message one\" one one message-one &&\n> -\ttest_commit \"message two\" two two message-two\n> +\ttest_commit \"message two\" two two message-two &&\n> +\thead1=$(git rev-list --max-count=1 --abbrev-commit HEAD~0) &&\n> +\thead2=$(git rev-list --max-count=1 --abbrev-commit HEAD~1) &&\n> +\thead3=$(git rev-list --max-count=1 --abbrev-commit HEAD~2) &&\n> +\thead4=$(git rev-list --max-count=1 --abbrev-commit HEAD~3)\n\nHmmph.  Why not rev-parse --short like in your 1/5?\n"},{"id":"221927","messageId":"cover.1372149305.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1371720245.git.Alex.Crezoff@gmail.com","subject":"[PATCH v6 0/5] Reroll patches against v1.8.3.1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-25T08:55:27Z","receivedAt":"2013-06-25T08:55:27Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"It's all started here [http://thread.gmane.org/gmane.comp.version-control.git/177634]\nand recently continued later [http://thread.gmane.org/gmane.comp.version-control.git/214419]\n\nv6 of this patch series includes Junio's suggestions against v5:\n\n1. [PATCH v6 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n\tusing modern 'git rev-parse HEAD:' git syntax to get commit tree ID\n2. [PATCH v6 2/5] t7102 (reset): don't hardcode SHA-1 in expected outputs\n\tuntouched\n3. [PATCH v6 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n\tusing 'rev-parse --short' instead of 'git rev-list --max-count=1 --abbrev-commit'\n4. [PATCH v6 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding\n\tiso8859-5 encoding reverted back to cp1251 encoding (as it was in v4 series)\n\treworded log message\n5. [PATCH v6 5/5] pretty: --format output should honor logOutputEncoding\n\treworded log message\n\n\nAlexey Shumkin (5):\n  t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n  t7102 (reset): don't hardcode SHA-1 in expected outputs\n  t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n  pretty: Add failing tests: --format output should honor\n    logOutputEncoding\n  pretty: --format output should honor logOutputEncoding\n\n builtin/reset.c                  |   6 +-\n builtin/rev-list.c               |   1 +\n builtin/shortlog.c               |   1 +\n log-tree.c                       |   1 +\n submodule.c                      |   1 +\n t/t4041-diff-submodule-option.sh |  25 +++--\n t/t4205-log-pretty-formats.sh    | 179 ++++++++++++++++++++-------------\n t/t6006-rev-list-format.sh       | 207 ++++++++++++++++++++++++---------------\n t/t7102-reset.sh                 |  37 ++++++-\n 9 files changed, 293 insertions(+), 165 deletions(-)\n\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221932","messageId":"b67a3a9e4320465c771a47559b45665bd45f9194.1372149305.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372149305.git.Alex.Crezoff@gmail.com","subject":"[PATCH v6 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-25T08:55:28Z","receivedAt":"2013-06-25T08:55:28Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t6006-rev-list-format.sh | 140 +++++++++++++++++++++++++--------------------\n 1 file changed, 77 insertions(+), 63 deletions(-)\n\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 0393c9f..cc1008d 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -7,8 +7,19 @@ test_description='git rev-list --pretty=format test'\n \n test_tick\n test_expect_success 'setup' '\n-touch foo && git add foo && git commit -m \"added foo\" &&\n-  echo changed >foo && git commit -a -m \"changed foo\"\n+\t: >foo &&\n+\tgit add foo &&\n+\tgit commit -m \"added foo\" &&\n+\thead1=$(git rev-parse --verify HEAD) &&\n+\thead1_short=$(git rev-parse --verify --short $head1) &&\n+\ttree1=$(git rev-parse --verify HEAD:) &&\n+\ttree1_short=$(git rev-parse --verify --short $tree1) &&\n+\techo changed >foo &&\n+\tgit commit -a -m \"changed foo\" &&\n+\thead2=$(git rev-parse --verify HEAD) &&\n+\thead2_short=$(git rev-parse --verify --short $head2) &&\n+\ttree2=$(git rev-parse --verify HEAD:) &&\n+\ttree2_short=$(git rev-parse --verify --short $tree2)\n '\n \n # usage: test_format name format_string <expected_output\n@@ -32,49 +43,49 @@ has_no_color () {\n \ttest_cmp expect \"$1\"\n }\n \n-test_format percent %%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format percent %%h <<EOF\n+commit $head2\n %h\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n %h\n EOF\n \n-test_format hash %H%n%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-131a310eb913d107dd3c09a65d1651175898735d\n-131a310\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n+test_format hash %H%n%h <<EOF\n+commit $head2\n+$head2\n+$head2_short\n+commit $head1\n+$head1\n+$head1_short\n EOF\n \n-test_format tree %T%n%t <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-fe722612f26da5064c32ca3843aa154bdb0b08a0\n-fe72261\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-4d5fcadc293a348e88f777dc0920f11e7d71441c\n-4d5fcad\n+test_format tree %T%n%t <<EOF\n+commit $head2\n+$tree2\n+$tree2_short\n+commit $head1\n+$tree1\n+$tree1_short\n EOF\n \n-test_format parents %P%n%p <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format parents %P%n%p <<EOF\n+commit $head2\n+$head1\n+$head1_short\n+commit $head1\n \n \n EOF\n \n # we don't test relative here\n-test_format author %an%n%ae%n%ad%n%aD%n%at <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format author %an%n%ae%n%ad%n%aD%n%at <<EOF\n+commit $head2\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -82,14 +93,14 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<EOF\n+commit $head2\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -97,43 +108,43 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format encoding %e <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format encoding %e <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format subject %s <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format subject %s <<EOF\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format body %b <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format body %b <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format raw-body %B <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format raw-body %B <<EOF\n+commit $head2\n changed foo\n \n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n \n EOF\n \n-test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<EOF\n+commit $head2\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n EOF\n \n-test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<EOF\n+commit $head2\n \u001b[1;31;43mfoo\u001b[m\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[1;31;43mfoo\u001b[m\n EOF\n \n@@ -186,39 +197,42 @@ This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: �bueno!\n EOF\n+\n test_expect_success 'setup complex body' '\n-git config i18n.commitencoding iso8859-1 &&\n-  echo change2 >foo && git commit -a -F commit-msg\n+\tgit config i18n.commitencoding iso8859-1 &&\n+\techo change2 >foo && git commit -a -F commit-msg &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n+\thead3_short=$(git rev-parse --short $head3)\n '\n \n-test_format complex-encoding %e <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-encoding %e <<EOF\n+commit $head3\n iso8859-1\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n-test_format complex-subject %s <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-subject %s <<EOF\n+commit $head3\n Test printing of complex bodies\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format complex-body %b <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-body %b <<EOF\n+commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: �bueno!\n \n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n test_expect_success '%x00 shows NUL' '\n-\techo  >expect commit 1ed88da4a5b5ed8c449114ac131efc62178734c3 &&\n+\techo  >expect commit $head3 &&\n \techo >>expect fooQbar &&\n \tgit rev-list -1 --format=foo%x00bar HEAD >actual.nul &&\n \tnul_to_q <actual.nul >actual &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221928","messageId":"db67c6cd80278257b925f5824d1d96d5036d2d24.1372149305.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372149305.git.Alex.Crezoff@gmail.com","subject":"[PATCH v6 2/5] t7102 (reset): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-25T08:55:29Z","receivedAt":"2013-06-25T08:55:29Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t7102-reset.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex df82ec9..05dfb27 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -192,7 +192,8 @@ test_expect_success \\\n \t'changing files and redo the last commit should succeed' '\n \techo \"3rd line 2nd file\" >>secondfile &&\n \tgit commit -a -C ORIG_HEAD &&\n-\tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n+\thead4=$(git rev-parse --verify HEAD) &&\n+\tcheck_changes $head4 &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n \t\t\t$head5\n '\n@@ -211,7 +212,7 @@ test_expect_success \\\n \tgit reset --hard HEAD~2 &&\n \tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n-\t\t\t3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d\n+\t\t\t$head4\n '\n \n >.diff_expect\n@@ -326,10 +327,11 @@ test_expect_success '--hard reset to HEAD should clear a failed merge' '\n \tgit checkout branch2 &&\n \techo \"3rd line in branch2\" >>secondfile &&\n \tgit commit -a -m \"change in branch2\" &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n \n \ttest_must_fail git pull . branch1 &&\n \tgit reset --hard &&\n-\tcheck_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb\n+\tcheck_changes $head3\n '\n \n >.diff_expect\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221931","messageId":"21a6f94ba53a1e130fd2153af46aae7467f6e0b5.1372149305.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372149305.git.Alex.Crezoff@gmail.com","subject":"[PATCH v6 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-25T08:55:30Z","receivedAt":"2013-06-25T08:55:30Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 48 +++++++++++++++++++++++--------------------\n 1 file changed, 26 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 26fbfde..73ba5e8 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '\n \n test_expect_success 'setup more commits' '\n \ttest_commit \"message one\" one one message-one &&\n-\ttest_commit \"message two\" two two message-two\n+\ttest_commit \"message two\" two two message-two &&\n+\thead1=$(git rev-parse --verify --short HEAD~0) &&\n+\thead2=$(git rev-parse --verify --short HEAD~1) &&\n+\thead3=$(git rev-parse --verify --short HEAD~2) &&\n+\thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n test_expect_success 'left alignment formatting' '\n@@ -117,18 +121,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %<|(40)%s\" >actual &&\n+test_expect_success 'left alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1 message two                    Z\n-7cd6c63 message one                    Z\n-1711bf9 add bar                        Z\n-af20c06 initial                        Z\n+$head1 message two                    Z\n+$head2 message one                    Z\n+$head3 add bar                        Z\n+$head4 initial                        Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'left alignment formatting with no padding' '\n \tgit log --pretty=\"format:%<(1)%s\" >actual &&\n@@ -195,18 +199,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'right alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %>|(40)%s\" >actual &&\n+test_expect_success 'right alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1                      message two\n-7cd6c63                      message one\n-1711bf9                          add bar\n-af20c06                          initial\n+$head1                      message two\n+$head2                      message one\n+$head3                          add bar\n+$head4                          initial\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'right alignment formatting with no padding' '\n \tgit log --pretty=\"format:%>(1)%s\" >actual &&\n@@ -234,18 +238,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'center alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %><|(40)%s\" >actual &&\n+test_expect_success 'center alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1           message two          Z\n-7cd6c63           message one          Z\n-1711bf9             add bar            Z\n-af20c06             initial            Z\n+$head1           message two          Z\n+$head2           message one          Z\n+$head3             add bar            Z\n+$head4             initial            Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'center alignment formatting with no padding' '\n \tgit log --pretty=\"format:%><(1)%s\" >actual &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221930","messageId":"44d13d28427c524c896f9eb4873e60f66f2fd20c.1372149305.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372149305.git.Alex.Crezoff@gmail.com","subject":"[PATCH v6 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-25T08:55:31Z","receivedAt":"2013-06-25T08:55:31Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"One can set an alias\n\t$ git config alias.lg \"log --graph --pretty=format:'%Cred%h%Creset\n\t-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset'\n\t--abbrev-commit --date=local\"\n\nto see the log as a pretty tree (like *gitk* but in a terminal).\n\nHowever, log messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted even when i18n.logOutputEncoding\nand terminal encoding are the same (e.g. log messages committed on a Cygwin box\nwith Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa).\n\nTo simplify an example we can say the following two commands are expected\nto give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it formats \"%s\".\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nThis patch adds failing tests for the next patch that fixes them.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |  35 +++++----\n t/t4205-log-pretty-formats.sh    | 149 ++++++++++++++++++++++++---------------\n t/t6006-rev-list-format.sh       |  83 +++++++++++++++-------\n t/t7102-reset.sh                 |  29 +++++++-\n 4 files changed, 199 insertions(+), 97 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 32d4a60..67afb86 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -1,6 +1,7 @@\n #!/bin/sh\n #\n # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Support for verbose submodule differences in git diff\n@@ -10,6 +11,9 @@ This test tries to verify the sanity of the --submodule option of git diff.\n \n . ./test-lib.sh\n \n+# String \"added\" in Russian, encoded in UTF-8, used in\n+# sample commit log messages in add_file() function below.\n+added=$(printf \"\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275\")\n add_file () {\n \t(\n \t\tcd \"$1\" &&\n@@ -19,7 +23,8 @@ add_file () {\n \t\t\techo \"$name\" >\"$name\" &&\n \t\t\tgit add \"$name\" &&\n \t\t\ttest_tick &&\n-\t\t\tgit commit -m \"Add $name\" || exit\n+\t\t\tmsg_added_cp1251=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t cp1251) &&\n+\t\t\tgit -c 'i18n.commitEncoding=cp1251' commit -m \"$msg_added_cp1251\"\n \t\tdone >/dev/null &&\n \t\tgit rev-parse --short --verify HEAD\n \t)\n@@ -89,29 +94,29 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward) --submodule' '\n+test_expect_failure 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n@@ -138,25 +143,25 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_success 'modified submodule(backward)' '\n+test_expect_failure 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_success 'modified submodule(backward and forward)' '\n+test_expect_failure 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\n-\t  > Add foo5\n-\t  > Add foo4\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  > Add foo5 ($added foo5)\n+\t  > Add foo4 ($added foo4)\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 73ba5e8..a45bb55 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -1,20 +1,43 @@\n #!/bin/sh\n #\n # Copyright (c) 2010, Will Palmer\n+# Copyright (c) 2011, Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+commit_msg() {\n+\t# String \"initial commit\" partly in Russian, encoded in UTF-8,\n+\t# used as a commit log message below.\n+\tmsg=$(printf \"initial \\320\\272\\320\\276\\320\\274\\320\\274\\320\\270\\321\\202\")\n+\tif test -n \"$1\"\n+\tthen\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\tif test -n \"$2\" -a -n \"$3\"\n+\tthen\n+\t\t# cut string, replace cut part with two dots\n+\t\t# $2 - chars count from the beginning of the string\n+\t\t# $3 - \"trailing\" chars\n+\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n+\t\t# as it does with C locale\n+\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'set up basic repos' '\n \t>foo &&\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit commit -m initial &&\n+\tgit config i18n.commitEncoding cp1251 &&\n+\tgit commit -m \"$(commit_msg cp1251)\" &&\n \tgit add bar &&\n \ttest_tick &&\n-\tgit commit -m \"add bar\"\n+\tgit commit -m \"add bar\" &&\n+\tgit config --unset i18n.commitEncoding\n '\n \n test_expect_success 'alias builtin format' '\n@@ -38,6 +61,20 @@ test_expect_success 'alias user-defined format' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'alias user-defined tformat with %s (cp1251 encoding)' '\n+\tgit config i18n.logOutputEncoding cp1251 &&\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\tgit config --unset i18n.logOutputEncoding &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n+test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n test_expect_success 'alias user-defined tformat' '\n \tgit log --pretty=\"tformat:%h\" >expected &&\n \tgit config pretty.test-alias \"tformat:%h\" &&\n@@ -71,22 +108,22 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_success 'NUL separation' '\n-\tprintf \"add bar\\0initial\" >expected &&\n+test_expect_failure 'NUL separation' '\n+\tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL termination' '\n-\tprintf \"add bar\\0initial\\0\" >expected &&\n+test_expect_failure 'NUL termination' '\n+\tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL separation with --stat' '\n+test_expect_failure 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n \tgit log -z --stat --pretty=\"format:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -94,7 +131,7 @@ test_expect_success 'NUL separation with --stat' '\n test_expect_failure 'NUL termination with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\\0\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n0\" >expected &&\n \tgit log -z --stat --pretty=\"tformat:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -108,20 +145,20 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n-test_expect_success 'left alignment formatting' '\n-\tgit log --pretty=\"format:%<(40)%s\" >actual &&\n+test_expect_failure 'left alignment formatting' \"\n+\tgit log --pretty='format:%<(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n message two                            Z\n message one                            Z\n add bar                                Z\n-initial                                Z\n+$(commit_msg)                         Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting at the nth column' \"\n+test_expect_failure 'left alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -129,77 +166,77 @@ test_expect_success 'left alignment formatting at the nth column' \"\n $head1 message two                    Z\n $head2 message one                    Z\n $head3 add bar                        Z\n-$head4 initial                        Z\n+$head4 $(commit_msg)                 Z\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'left alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%<(1)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with no padding' \"\n+\tgit log --pretty='format:%<(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with trunc' '\n-\tgit log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with trunc' \"\n+\tgit log --pretty='format:%<(10,trunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n message ..\n message ..\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"8\" \".\\+$\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with ltrunc' '\n-\tgit log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with ltrunc' \"\n+\tgit log --pretty='format:%<(10,ltrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n ..sage two\n ..sage one\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"0\" \".\\{6\\}\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with mtrunc' '\n-\tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with mtrunc' \"\n+\tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n mess.. two\n mess.. one\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"4\" \".\\{6\\}\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'right alignment formatting' '\n-\tgit log --pretty=\"format:%>(40)%s\" >actual &&\n+test_expect_failure 'right alignment formatting' \"\n+\tgit log --pretty='format:%>(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n Z                            message two\n Z                            message one\n Z                                add bar\n-Z                                initial\n+Z                         $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'right alignment formatting at the nth column' \"\n+test_expect_failure 'right alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -207,38 +244,38 @@ test_expect_success 'right alignment formatting at the nth column' \"\n $head1                      message two\n $head2                      message one\n $head3                          add bar\n-$head4                          initial\n+$head4                   $(commit_msg)\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'right alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%>(1)%s\" >actual &&\n+test_expect_failure 'right alignment formatting with no padding' \"\n+\tgit log --pretty='format:%>(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'center alignment formatting' '\n-\tgit log --pretty=\"format:%><(40)%s\" >actual &&\n+test_expect_failure 'center alignment formatting' \"\n+\tgit log --pretty='format:%><(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n Z             message two              Z\n Z             message one              Z\n Z               add bar                Z\n-Z               initial                Z\n+Z            $(commit_msg)            Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'center alignment formatting at the nth column' \"\n+test_expect_failure 'center alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -246,36 +283,36 @@ test_expect_success 'center alignment formatting at the nth column' \"\n $head1           message two          Z\n $head2           message one          Z\n $head3             add bar            Z\n-$head4             initial            Z\n+$head4          $(commit_msg)        Z\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'center alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%><(1)%s\" >actual &&\n+test_expect_failure 'center alignment formatting with no padding' \"\n+\tgit log --pretty='format:%><(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left/right alignment formatting with stealing' '\n-\tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n-\tgit log --pretty=\"format:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n+test_expect_failure 'left/right alignment formatting with stealing' \"\n+\tgit commit --amend -m short --author 'long long long <long@me.com>' &&\n+\tgit log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n-initial      A U Thor\n+$(commit_msg \"\" \"8\" \".\\+$\")   A U Thor\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_done\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex cc1008d..ce62214 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -1,34 +1,60 @@\n #!/bin/sh\n \n+# Copyright (c) 2009 Jens Lehmann\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n+\n test_description='git rev-list --pretty=format test'\n \n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-terminal.sh\n \n test_tick\n+# String \"added\" in Russian, encoded in UTF-8,\n+# used as a commit log message below.\n+added=$(printf \"added (\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275) foo\")\n+added_cp1251=$(echo \"$added\" | iconv -f utf-8 -t cp1251)\n+# same but \"changed\"\n+changed=$(printf \"changed (\\320\\264\\320\\276\\320\\261\\320\\260\\320\\262\\320\\273\\320\\265\\320\\275) foo\")\n+changed_cp1251=$(echo \"$changed\" | iconv -f utf-8 -t cp1251)\n+\n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n-\tgit commit -m \"added foo\" &&\n+\tgit config i18n.commitEncoding cp1251 &&\n+\tgit commit -m \"$added_cp1251\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_short=$(git rev-parse --verify --short $head1) &&\n \ttree1=$(git rev-parse --verify HEAD:) &&\n \ttree1_short=$(git rev-parse --verify --short $tree1) &&\n-\techo changed >foo &&\n-\tgit commit -a -m \"changed foo\" &&\n+\techo \"$changed\" > foo &&\n+\tgit commit -a -m \"$changed_cp1251\" &&\n \thead2=$(git rev-parse --verify HEAD) &&\n \thead2_short=$(git rev-parse --verify --short $head2) &&\n \ttree2=$(git rev-parse --verify HEAD:) &&\n \ttree2_short=$(git rev-parse --verify --short $tree2)\n+\tgit config --unset i18n.commitEncoding\n '\n \n-# usage: test_format name format_string <expected_output\n+# usage: test_format [failure] name format_string <expected_output\n test_format () {\n+\tmust_fail=0\n+\t# if parameters count is more than 2 then test must fail\n+\tif test $# -gt 2\n+\tthen\n+\t\tmust_fail=1\n+\t\t# remove first parameter which is flag for test failure\n+\t\tshift\n+\tfi\n \tcat >expect.$1\n-\ttest_expect_success \"format $1\" \"\n-\t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n-\t\ttest_cmp expect.$1 output.$1\n-\t\"\n+\tname=\"format $1\"\n+\tcommand=\"git rev-list --pretty=format:'$2' master >output.$1 &&\n+\t\ttest_cmp expect.$1 output.$1\"\n+\tif test $must_fail -eq 1\n+\tthen\n+\t\ttest_expect_failure \"$name\" \"$command\"\n+\telse\n+\t\ttest_expect_success \"$name\" \"$command\"\n+\tfi\n }\n \n # Feed to --format to provide predictable colored sequences.\n@@ -110,14 +136,16 @@ EOF\n \n test_format encoding %e <<EOF\n commit $head2\n+cp1251\n commit $head1\n+cp1251\n EOF\n \n-test_format subject %s <<EOF\n+test_format failure subject %s <<EOF\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n test_format body %b <<EOF\n@@ -125,12 +153,12 @@ commit $head2\n commit $head1\n EOF\n \n-test_format raw-body %B <<EOF\n+test_format failure raw-body %B <<EOF\n commit $head2\n-changed foo\n+$changed\n \n commit $head1\n-added foo\n+$added\n \n EOF\n \n@@ -190,42 +218,49 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '\n \t)\n '\n \n-cat >commit-msg <<'EOF'\n+iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF\n Test printing of complex bodies\n \n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: �bueno!\n+include an iso8859 character: ¡bueno!\n EOF\n \n test_expect_success 'setup complex body' '\n \tgit config i18n.commitencoding iso8859-1 &&\n \techo change2 >foo && git commit -a -F commit-msg &&\n \thead3=$(git rev-parse --verify HEAD) &&\n-\thead3_short=$(git rev-parse --short $head3)\n+\thead3_short=$(git rev-parse --short $head3) &&\n+\t# unset commit encoding config\n+\t# otherwise %e does not print encoding value\n+\t# and following test fails\n+\tgit config --unset i18n.commitEncoding\n+\n '\n \n test_format complex-encoding %e <<EOF\n commit $head3\n iso8859-1\n commit $head2\n+cp1251\n commit $head1\n+cp1251\n EOF\n \n-test_format complex-subject %s <<EOF\n+test_format failure complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n-test_format complex-body %b <<EOF\n+test_format failure complex-body %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: �bueno!\n+include an iso8859 character: ¡bueno!\n \n commit $head2\n commit $head1\n@@ -279,12 +314,12 @@ test_expect_success 'add LF before non-empty (2)' '\n \n test_expect_success 'add SP before non-empty (1)' '\n \tgit show -s --pretty=format:\"%s% bThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 2\n+\ttest $(wc -w <actual) = 3\n '\n \n test_expect_success 'add SP before non-empty (2)' '\n \tgit show -s --pretty=format:\"%s% sThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 4\n+\ttest $(wc -w <actual) = 6\n '\n \n test_expect_success '--abbrev' '\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 05dfb27..19a4cf4 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -9,6 +9,17 @@ Documented tests for git reset'\n \n . ./test-lib.sh\n \n+commit_msg() {\n+\t# String \"2nd file modified\" in Russian, encoded in UTF-8,\n+\t# used as a commit log message below.\n+\tmsg=$(printf \"modify 2nd file (\\320\\270\\320\\267\\320\\274\\320\\265\\320\\275\\321\\221\\320\\275 \\321\\204\\320\\260\\320\\271\\320\\273)\")\n+\tif test -n \"$1\"\n+\tthen\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'creating initial files and commits' '\n \ttest_tick &&\n \techo \"1st file\" >first &&\n@@ -28,7 +39,7 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=cp1251\" commit -a -m \"$(commit_msg cp1251)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -44,6 +55,20 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n+test_expect_failure 'reset --hard message' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg) > .expected &&\n+\ttest_cmp .expected .actual\n+'\n+\n+test_expect_success 'reset --hard message (cp1251 logoutencoding)' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit -c \"i18n.logOutputEncoding=cp1251\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg cp1251) > .expected &&\n+\ttest_cmp .expected .actual\n+'\n+\n >.diff_expect\n >.cached_expect\n cat >.cat_expect <<EOF\n@@ -304,7 +329,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=cp1251\" commit -a -m \"$(commit_msg cp1251)\" &&\n \tcheck_changes $head5\n '\n \n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221929","messageId":"4860f22b6d11768a07be0243f1ef2269fe3a0dcc.1372149305.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372149305.git.Alex.Crezoff@gmail.com","subject":"[PATCH v6 5/5] pretty: --format output should honor logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-25T08:55:32Z","receivedAt":"2013-06-25T08:55:32Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"One can set an alias\n\t$ git config [--global] alias.lg \"log --graph --pretty=format:'%Cred%h%Creset\n\t-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset'\n\t--abbrev-commit --date=local\"\n\nto see the log as a pretty tree (like *gitk* but in a terminal).\n\nHowever, log messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted even when i18n.logOutputEncoding\nand terminal encoding are the same (e.g. log messages committed on a Cygwin box\nwith Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa).\n\nTo simplify an example we can say the following two commands are expected\nto give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it formats \"%s\".\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nThis patch makes pretty --format honor logOutputEncoding when it formats\nlog message.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n builtin/reset.c                  |  6 ++++--\n builtin/rev-list.c               |  1 +\n builtin/shortlog.c               |  1 +\n log-tree.c                       |  1 +\n submodule.c                      |  1 +\n t/t4041-diff-submodule-option.sh | 10 +++++-----\n t/t4205-log-pretty-formats.sh    | 34 +++++++++++++++++-----------------\n t/t6006-rev-list-format.sh       |  8 ++++----\n t/t7102-reset.sh                 |  2 +-\n 9 files changed, 35 insertions(+), 29 deletions(-)\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 6032131..a6cacc6 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -92,11 +92,12 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet)\n \n static void print_new_head_line(struct commit *commit)\n {\n-\tconst char *hex, *body;\n+\tconst char *hex, *body, *msg;\n \n \thex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);\n \tprintf(_(\"HEAD is now at %s\"), hex);\n-\tbody = strstr(commit->buffer, \"\\n\\n\");\n+\tmsg = logmsg_reencode(commit, NULL, get_log_output_encoding());\n+\tbody = strstr(msg, \"\\n\\n\");\n \tif (body) {\n \t\tconst char *eol;\n \t\tsize_t len;\n@@ -107,6 +108,7 @@ static void print_new_head_line(struct commit *commit)\n \t}\n \telse\n \t\tprintf(\"\\n\");\n+\tlogmsg_free(msg, commit);\n }\n \n static void update_index_from_diff(struct diff_queue_struct *q,\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 67701be..a5ec30d 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -111,6 +111,7 @@ static void show_commit(struct commit *commit, void *data)\n \t\tctx.date_mode = revs->date_mode;\n \t\tctx.date_mode_explicit = revs->date_mode_explicit;\n \t\tctx.fmt = revs->commit_format;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &buf);\n \t\tif (revs->graph) {\n \t\t\tif (buf.len) {\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 1fd6f8a..1434f8f 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -137,6 +137,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n \t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &ufbuf);\n \t\tbuffer = ufbuf.buf;\n \t} else if (*buffer) {\ndiff --git a/log-tree.c b/log-tree.c\nindex 1946e9c..5277d3e 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -616,6 +616,7 @@ void show_log(struct rev_info *opt)\n \tctx.fmt = opt->commit_format;\n \tctx.mailmap = opt->mailmap;\n \tctx.color = opt->diffopt.use_color;\n+\tctx.output_encoding = get_log_output_encoding();\n \tpretty_print_commit(&ctx, commit, &msgbuf);\n \n \tif (opt->add_signoff)\ndiff --git a/submodule.c b/submodule.c\nindex 1821a5b..78734e1 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -226,6 +226,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,\n \twhile ((commit = get_revision(rev))) {\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode = rev->date_mode;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tstrbuf_setlen(&sb, 0);\n \t\tstrbuf_addstr(&sb, line_prefix);\n \t\tif (commit->object.flags & SYMMETRIC_LEFT) {\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 67afb86..9ba4b8e 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -94,7 +94,7 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -103,7 +103,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -112,7 +112,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward) --submodule' '\n+test_expect_success 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -143,7 +143,7 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_failure 'modified submodule(backward)' '\n+test_expect_success 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n@@ -154,7 +154,7 @@ test_expect_failure 'modified submodule(backward)' '\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_failure 'modified submodule(backward and forward)' '\n+test_expect_success 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex a45bb55..5a14124 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -69,7 +69,7 @@ test_expect_success 'alias user-defined tformat with %s (cp1251 encoding)' '\n \ttest_cmp expected-s actual-s\n '\n \n-test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+test_expect_success 'alias user-defined tformat with %s (utf-8 encoding)' '\n \tgit log --oneline >expected-s &&\n \tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n \ttest_cmp expected-s actual-s\n@@ -108,19 +108,19 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_failure 'NUL separation' '\n+test_expect_success 'NUL separation' '\n \tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL termination' '\n+test_expect_success 'NUL termination' '\n \tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL separation with --stat' '\n+test_expect_success 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n \tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n@@ -145,7 +145,7 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n-test_expect_failure 'left alignment formatting' \"\n+test_expect_success 'left alignment formatting' \"\n \tgit log --pretty='format:%<(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -158,7 +158,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting at the nth column' \"\n+test_expect_success 'left alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -171,7 +171,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with no padding' \"\n+test_expect_success 'left alignment formatting with no padding' \"\n \tgit log --pretty='format:%<(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -184,7 +184,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with trunc' \"\n+test_expect_success 'left alignment formatting with trunc' \"\n \tgit log --pretty='format:%<(10,trunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -197,7 +197,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with ltrunc' \"\n+test_expect_success 'left alignment formatting with ltrunc' \"\n \tgit log --pretty='format:%<(10,ltrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -210,7 +210,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with mtrunc' \"\n+test_expect_success 'left alignment formatting with mtrunc' \"\n \tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -223,7 +223,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting' \"\n+test_expect_success 'right alignment formatting' \"\n \tgit log --pretty='format:%>(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -236,7 +236,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting at the nth column' \"\n+test_expect_success 'right alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -249,7 +249,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting with no padding' \"\n+test_expect_success 'right alignment formatting with no padding' \"\n \tgit log --pretty='format:%>(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -262,7 +262,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting' \"\n+test_expect_success 'center alignment formatting' \"\n \tgit log --pretty='format:%><(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -275,7 +275,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting at the nth column' \"\n+test_expect_success 'center alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -288,7 +288,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting with no padding' \"\n+test_expect_success 'center alignment formatting with no padding' \"\n \tgit log --pretty='format:%><(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -301,7 +301,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left/right alignment formatting with stealing' \"\n+test_expect_success 'left/right alignment formatting with stealing' \"\n \tgit commit --amend -m short --author 'long long long <long@me.com>' &&\n \tgit log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&\n \t# complete the incomplete line at the end\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex ce62214..6356046 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -141,7 +141,7 @@ commit $head1\n cp1251\n EOF\n \n-test_format failure subject %s <<EOF\n+test_format subject %s <<EOF\n commit $head2\n $changed\n commit $head1\n@@ -153,7 +153,7 @@ commit $head2\n commit $head1\n EOF\n \n-test_format failure raw-body %B <<EOF\n+test_format raw-body %B <<EOF\n commit $head2\n $changed\n \n@@ -247,7 +247,7 @@ commit $head1\n cp1251\n EOF\n \n-test_format failure complex-subject %s <<EOF\n+test_format complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n@@ -256,7 +256,7 @@ commit $head1\n $added\n EOF\n \n-test_format failure complex-body %b <<EOF\n+test_format complex-body %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 19a4cf4..ea96e43 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -55,7 +55,7 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n-test_expect_failure 'reset --hard message' '\n+test_expect_success 'reset --hard message' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg) > .expected &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"221964","messageId":"7vppva2dod.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"cover.1372149305.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v6 0/5] Reroll patches against v1.8.3.1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-25T19:28:02Z","receivedAt":"2013-06-25T19:28:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n\n> 4. [PATCH v6 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding\n> \tiso8859-5 encoding reverted back to cp1251 encoding (as it was in v4 series)\n\nThanks for a reroll, but why this change?\n\nThe reason I asked you to avoid 8859-5 is because our test do not\nuse that encoding and I do not want to add new dependency to people\nwhen they run test.  cp1251 shares exactly the same issue, doesn't\nit?  So in that sense, this change does not make anything better.\n\nThat is why I asked you if the breakage you are trying to\ndemonstrate about non-ASCII non-UTF8 encoding was specific to\nCyrillic/Russian.  I do not recall seeing your answer, but what is\nthe right thing to do depend on it.\n\n - If the answer is yes, then we would need to add dependency either\n   way, and 8859-5 is just as fine as cp1251.\n\n - If the breakage is not specific to Cyrillic, it should be\n   reproducible using 8859-1 (latin-1), and our tests already depend\n   on 8859-1, so we wouldn't be adding new dependencies on people.\n"},{"id":"222011","messageId":"20130626073423.GA23688@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vppva2dod.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v6 0/5] Reroll patches against v1.8.3.1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-26T07:37:09Z","receivedAt":"2013-06-26T07:37:09Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Tue, Jun 25, 2013 at 12:28:02PM -0700, Junio C Hamano wrote:\n> Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n> \n> > 4. [PATCH v6 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding\n> > \tiso8859-5 encoding reverted back to cp1251 encoding (as it was in v4 series)\n> \n> Thanks for a reroll, but why this change?\n> \n> The reason I asked you to avoid 8859-5 is because our test do not\n> use that encoding and I do not want to add new dependency to people\n> when they run test.  cp1251 shares exactly the same issue, doesn't\n> it?  So in that sense, this change does not make anything better.\n> \n> That is why I asked you if the breakage you are trying to\n> demonstrate about non-ASCII non-UTF8 encoding was specific to\n> Cyrillic/Russian.  I do not recall seeing your answer, but what is\n> the right thing to do depend on it.\n> \n>  - If the answer is yes, then we would need to add dependency either\n>    way, and 8859-5 is just as fine as cp1251.\n> \n>  - If the breakage is not specific to Cyrillic, it should be\n>    reproducible using 8859-1 (latin-1), and our tests already depend\n>    on 8859-1, so we wouldn't be adding new dependencies on people.\n> \n\nI suppose you've missed my answer somehow. It was:\n---8<---\n> Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n> \n> > @@ -19,7 +23,8 @@ add_file () {\n> >  \t\t\techo \"$name\" >\"$name\" &&\n> >  \t\t\tgit add \"$name\" &&\n> >  \t\t\ttest_tick &&\n> > -\t\t\tgit commit -m \"Add $name\" || exit\n> > +\t\t\tmsg_added_iso88595=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso88595) &&\n> > +\t\t\tgit -c 'i18n.commitEncoding=iso88595' commit -m \"$msg_added_iso88595\"\n> \n> Hmph.  Do we know 8859-5 is available or do these need to be\n> protected with prereq?\nOpps, this encoding is absent even in my Cygwin box :)\nActually, previuosly, there was a Windows-1251 encoding,\nyou said we'd prefer to limit different encodings used in tests,\nAnd I've made an attempt to avoid this but I'm way off the mark.\n\n> \n> Can these tests be done with 8859-1 i.e. something we already depend\n> on, by changing that $added message to latin-1, or is there something\n> very Russian specific breakage we want to test here?\nWell, actually, most popular Russian 8-bit codepages are Windows-1251 (aka cp1251) and KOI8-R.\nCygwin (as a \"Linux box on Windows\") uses cp1251.\nIconv cannot even convert Russian messages from cp1251(or UTF-8) to latin1.\nIt fails.\n  $ echo \"коммит\" | LANG= iconv -t latin1 -f UTF-8 \n  iconv: illegal input sequence at position 0\n(\"коммит\" is a \"commit\" in Russian)\n\n> \n> If the former, please redo this entire patch (not just t4041) with\n> 8859-1.\n> \n> If there is some Russian specific breakage you cannot demonstrate\n> with 8859-1, then please explain it in the log message.\nWell, it's not a \"Russian specific\". It's \"codepage conversion\" specific,\nbut I cannot use latin1 codepage because I do not know any language that\nuses iso8859-1/latin1 codepage (as German, Spanish, for example) to\nwrite a commit message in it.\nIf someone can do the same with latin1, I'd be happy.\n> \n> > diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> > index d32e65e..36e4cc0 100755\n> > --- a/t/t6006-rev-list-format.sh\n> > +++ b/t/t6006-rev-list-format.sh\n> > ...\n> > -# usage: test_format name format_string <expected_output\n> > +# usage: test_format [failure] name format_string <expected_output\n> >  test_format () {\n> > +\tlocal must_fail=0\n> \n> This breaks tests for non-bash users.  \"local\" is not even in POSIX.\n---8<---\n\nBut today I've taken a look to Cygwin's locales more closely and found\nout that I've used incorrect encoding name (`iso88595` instead of \"canonic\"\n`iso-8859-5` that Cygwin has and \"understands\")\n\nNevertheless, as I've already said that is not a Russian locale specific\nissue.\nThe problem in tests for me now is a language (that uses iso-8859-1\nencoding) I do not speak or even write ;)\n\n-- \nAlexey Shumkin\n"},{"id":"222012","messageId":"cover.1372240998.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372149305.git.Alex.Crezoff@gmail.com","subject":"[PATCH v7 0/5] Reroll patches against v1.8.3.1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-26T10:19:45Z","receivedAt":"2013-06-26T10:19:45Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"v7 of this patch series includes the following changes against v6:\n1. [PATCH v7 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n\tuntouched\n2. [PATCH v7 2/5] t7102 (reset): don't hardcode SHA-1 in expected outputs\n\tuntouched\n3. [PATCH v7 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n\tuntouched\n4. [PATCH v7 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding\n    cp1251 encoding changed to iso-8859-1 encoding already used in tests\n    Test commit messages contain words (\"changed\" and \"added\") in German\n    (which is covered by iso-8859-1 encoding)\n    They are translated from English (verified in Russian) with Google Translate\n5. [PATCH v7 5/5] pretty: --format output should honor logOutputEncoding\n    builtin/reset.c:\n        \"const char ..., *msg;\" declaration replaced with \"char *msg;\"\n        to avoid compiler warning on the line \"logmsg_free(msg, commit);\"\n\nP.S.\nIt's all started here [http://thread.gmane.org/gmane.comp.version-control.git/177634]\n\nAlexey Shumkin (5):\n  t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n  t7102 (reset): don't hardcode SHA-1 in expected outputs\n  t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n  pretty: Add failing tests: --format output should honor\n    logOutputEncoding\n  pretty: --format output should honor logOutputEncoding\n\n builtin/reset.c                  |   5 +-\n builtin/rev-list.c               |   1 +\n builtin/shortlog.c               |   1 +\n log-tree.c                       |   1 +\n submodule.c                      |   1 +\n t/t4041-diff-submodule-option.sh |  25 +++--\n t/t4205-log-pretty-formats.sh    | 179 ++++++++++++++++++++-------------\n t/t6006-rev-list-format.sh       | 207 ++++++++++++++++++++++++---------------\n t/t7102-reset.sh                 |  37 ++++++-\n 9 files changed, 293 insertions(+), 164 deletions(-)\n\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222014","messageId":"b67a3a9e4320465c771a47559b45665bd45f9194.1372240998.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372240998.git.Alex.Crezoff@gmail.com","subject":"[PATCH v7 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-26T10:19:46Z","receivedAt":"2013-06-26T10:19:46Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t6006-rev-list-format.sh | 140 +++++++++++++++++++++++++--------------------\n 1 file changed, 77 insertions(+), 63 deletions(-)\n\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 0393c9f..cc1008d 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -7,8 +7,19 @@ test_description='git rev-list --pretty=format test'\n \n test_tick\n test_expect_success 'setup' '\n-touch foo && git add foo && git commit -m \"added foo\" &&\n-  echo changed >foo && git commit -a -m \"changed foo\"\n+\t: >foo &&\n+\tgit add foo &&\n+\tgit commit -m \"added foo\" &&\n+\thead1=$(git rev-parse --verify HEAD) &&\n+\thead1_short=$(git rev-parse --verify --short $head1) &&\n+\ttree1=$(git rev-parse --verify HEAD:) &&\n+\ttree1_short=$(git rev-parse --verify --short $tree1) &&\n+\techo changed >foo &&\n+\tgit commit -a -m \"changed foo\" &&\n+\thead2=$(git rev-parse --verify HEAD) &&\n+\thead2_short=$(git rev-parse --verify --short $head2) &&\n+\ttree2=$(git rev-parse --verify HEAD:) &&\n+\ttree2_short=$(git rev-parse --verify --short $tree2)\n '\n \n # usage: test_format name format_string <expected_output\n@@ -32,49 +43,49 @@ has_no_color () {\n \ttest_cmp expect \"$1\"\n }\n \n-test_format percent %%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format percent %%h <<EOF\n+commit $head2\n %h\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n %h\n EOF\n \n-test_format hash %H%n%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-131a310eb913d107dd3c09a65d1651175898735d\n-131a310\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n+test_format hash %H%n%h <<EOF\n+commit $head2\n+$head2\n+$head2_short\n+commit $head1\n+$head1\n+$head1_short\n EOF\n \n-test_format tree %T%n%t <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-fe722612f26da5064c32ca3843aa154bdb0b08a0\n-fe72261\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-4d5fcadc293a348e88f777dc0920f11e7d71441c\n-4d5fcad\n+test_format tree %T%n%t <<EOF\n+commit $head2\n+$tree2\n+$tree2_short\n+commit $head1\n+$tree1\n+$tree1_short\n EOF\n \n-test_format parents %P%n%p <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format parents %P%n%p <<EOF\n+commit $head2\n+$head1\n+$head1_short\n+commit $head1\n \n \n EOF\n \n # we don't test relative here\n-test_format author %an%n%ae%n%ad%n%aD%n%at <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format author %an%n%ae%n%ad%n%aD%n%at <<EOF\n+commit $head2\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -82,14 +93,14 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<EOF\n+commit $head2\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -97,43 +108,43 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format encoding %e <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format encoding %e <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format subject %s <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format subject %s <<EOF\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format body %b <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format body %b <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format raw-body %B <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format raw-body %B <<EOF\n+commit $head2\n changed foo\n \n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n \n EOF\n \n-test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<EOF\n+commit $head2\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n EOF\n \n-test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<EOF\n+commit $head2\n \u001b[1;31;43mfoo\u001b[m\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[1;31;43mfoo\u001b[m\n EOF\n \n@@ -186,39 +197,42 @@ This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: �bueno!\n EOF\n+\n test_expect_success 'setup complex body' '\n-git config i18n.commitencoding iso8859-1 &&\n-  echo change2 >foo && git commit -a -F commit-msg\n+\tgit config i18n.commitencoding iso8859-1 &&\n+\techo change2 >foo && git commit -a -F commit-msg &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n+\thead3_short=$(git rev-parse --short $head3)\n '\n \n-test_format complex-encoding %e <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-encoding %e <<EOF\n+commit $head3\n iso8859-1\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n-test_format complex-subject %s <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-subject %s <<EOF\n+commit $head3\n Test printing of complex bodies\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format complex-body %b <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-body %b <<EOF\n+commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: �bueno!\n \n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n test_expect_success '%x00 shows NUL' '\n-\techo  >expect commit 1ed88da4a5b5ed8c449114ac131efc62178734c3 &&\n+\techo  >expect commit $head3 &&\n \techo >>expect fooQbar &&\n \tgit rev-list -1 --format=foo%x00bar HEAD >actual.nul &&\n \tnul_to_q <actual.nul >actual &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222013","messageId":"db67c6cd80278257b925f5824d1d96d5036d2d24.1372240999.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372240998.git.Alex.Crezoff@gmail.com","subject":"[PATCH v7 2/5] t7102 (reset): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-26T10:19:47Z","receivedAt":"2013-06-26T10:19:47Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t7102-reset.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex df82ec9..05dfb27 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -192,7 +192,8 @@ test_expect_success \\\n \t'changing files and redo the last commit should succeed' '\n \techo \"3rd line 2nd file\" >>secondfile &&\n \tgit commit -a -C ORIG_HEAD &&\n-\tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n+\thead4=$(git rev-parse --verify HEAD) &&\n+\tcheck_changes $head4 &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n \t\t\t$head5\n '\n@@ -211,7 +212,7 @@ test_expect_success \\\n \tgit reset --hard HEAD~2 &&\n \tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n-\t\t\t3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d\n+\t\t\t$head4\n '\n \n >.diff_expect\n@@ -326,10 +327,11 @@ test_expect_success '--hard reset to HEAD should clear a failed merge' '\n \tgit checkout branch2 &&\n \techo \"3rd line in branch2\" >>secondfile &&\n \tgit commit -a -m \"change in branch2\" &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n \n \ttest_must_fail git pull . branch1 &&\n \tgit reset --hard &&\n-\tcheck_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb\n+\tcheck_changes $head3\n '\n \n >.diff_expect\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222015","messageId":"21a6f94ba53a1e130fd2153af46aae7467f6e0b5.1372240999.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372240998.git.Alex.Crezoff@gmail.com","subject":"[PATCH v7 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-26T10:19:48Z","receivedAt":"2013-06-26T10:19:48Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 48 +++++++++++++++++++++++--------------------\n 1 file changed, 26 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 26fbfde..73ba5e8 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '\n \n test_expect_success 'setup more commits' '\n \ttest_commit \"message one\" one one message-one &&\n-\ttest_commit \"message two\" two two message-two\n+\ttest_commit \"message two\" two two message-two &&\n+\thead1=$(git rev-parse --verify --short HEAD~0) &&\n+\thead2=$(git rev-parse --verify --short HEAD~1) &&\n+\thead3=$(git rev-parse --verify --short HEAD~2) &&\n+\thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n test_expect_success 'left alignment formatting' '\n@@ -117,18 +121,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %<|(40)%s\" >actual &&\n+test_expect_success 'left alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1 message two                    Z\n-7cd6c63 message one                    Z\n-1711bf9 add bar                        Z\n-af20c06 initial                        Z\n+$head1 message two                    Z\n+$head2 message one                    Z\n+$head3 add bar                        Z\n+$head4 initial                        Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'left alignment formatting with no padding' '\n \tgit log --pretty=\"format:%<(1)%s\" >actual &&\n@@ -195,18 +199,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'right alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %>|(40)%s\" >actual &&\n+test_expect_success 'right alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1                      message two\n-7cd6c63                      message one\n-1711bf9                          add bar\n-af20c06                          initial\n+$head1                      message two\n+$head2                      message one\n+$head3                          add bar\n+$head4                          initial\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'right alignment formatting with no padding' '\n \tgit log --pretty=\"format:%>(1)%s\" >actual &&\n@@ -234,18 +238,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'center alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %><|(40)%s\" >actual &&\n+test_expect_success 'center alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1           message two          Z\n-7cd6c63           message one          Z\n-1711bf9             add bar            Z\n-af20c06             initial            Z\n+$head1           message two          Z\n+$head2           message one          Z\n+$head3             add bar            Z\n+$head4             initial            Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'center alignment formatting with no padding' '\n \tgit log --pretty=\"format:%><(1)%s\" >actual &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222016","messageId":"9e83de68067be7548c0119d6e99caa905fab0c0f.1372240999.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372240998.git.Alex.Crezoff@gmail.com","subject":"[PATCH v7 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-26T10:19:49Z","receivedAt":"2013-06-26T10:19:49Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"One can set an alias\n\t$ git config alias.lg \"log --graph --pretty=format:'%Cred%h%Creset\n\t-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset'\n\t--abbrev-commit --date=local\"\n\nto see the log as a pretty tree (like *gitk* but in a terminal).\n\nHowever, log messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted even when i18n.logOutputEncoding\nand terminal encoding are the same (e.g. log messages committed on a Cygwin box\nwith Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa).\n\nTo simplify an example we can say the following two commands are expected\nto give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it formats \"%s\".\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nThis patch adds failing tests for the next patch that fixes them.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |  35 +++++----\n t/t4205-log-pretty-formats.sh    | 149 ++++++++++++++++++++++++---------------\n t/t6006-rev-list-format.sh       |  83 +++++++++++++++-------\n t/t7102-reset.sh                 |  29 +++++++-\n 4 files changed, 199 insertions(+), 97 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 32d4a60..2a7877d 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -1,6 +1,7 @@\n #!/bin/sh\n #\n # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Support for verbose submodule differences in git diff\n@@ -10,6 +11,9 @@ This test tries to verify the sanity of the --submodule option of git diff.\n \n . ./test-lib.sh\n \n+# String \"added\" in German (translated with Google Translate), encoded in UTF-8,\n+# used in sample commit log messages in add_file() function below.\n+added=$(printf \"hinzugef\\303\\274gt\")\n add_file () {\n \t(\n \t\tcd \"$1\" &&\n@@ -19,7 +23,8 @@ add_file () {\n \t\t\techo \"$name\" >\"$name\" &&\n \t\t\tgit add \"$name\" &&\n \t\t\ttest_tick &&\n-\t\t\tgit commit -m \"Add $name\" || exit\n+\t\t\tmsg_added_iso88591=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso-8859-1) &&\n+\t\t\tgit -c 'i18n.commitEncoding=iso-8859-1' commit -m \"$msg_added_iso88591\"\n \t\tdone >/dev/null &&\n \t\tgit rev-parse --short --verify HEAD\n \t)\n@@ -89,29 +94,29 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward) --submodule' '\n+test_expect_failure 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n@@ -138,25 +143,25 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_success 'modified submodule(backward)' '\n+test_expect_failure 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_success 'modified submodule(backward and forward)' '\n+test_expect_failure 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\n-\t  > Add foo5\n-\t  > Add foo4\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  > Add foo5 ($added foo5)\n+\t  > Add foo4 ($added foo4)\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 73ba5e8..6b62da2 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -1,20 +1,43 @@\n #!/bin/sh\n #\n # Copyright (c) 2010, Will Palmer\n+# Copyright (c) 2011, Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+commit_msg() {\n+\t# String \"initial. initial\" partly in German (translated with Google Translate),\n+\t# encoded in UTF-8, used as a commit log message below.\n+\tmsg=$(printf \"initial. anf\\303\\244nglich\")\n+\tif test -n \"$1\"\n+\tthen\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\tif test -n \"$2\" -a -n \"$3\"\n+\tthen\n+\t\t# cut string, replace cut part with two dots\n+\t\t# $2 - chars count from the beginning of the string\n+\t\t# $3 - \"trailing\" chars\n+\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n+\t\t# as it does with C locale\n+\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'set up basic repos' '\n \t>foo &&\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit commit -m initial &&\n+\tgit config i18n.commitEncoding iso-8859-1 &&\n+\tgit commit -m \"$(commit_msg iso-8859-1)\" &&\n \tgit add bar &&\n \ttest_tick &&\n-\tgit commit -m \"add bar\"\n+\tgit commit -m \"add bar\" &&\n+\tgit config --unset i18n.commitEncoding\n '\n \n test_expect_success 'alias builtin format' '\n@@ -38,6 +61,20 @@ test_expect_success 'alias user-defined format' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'alias user-defined tformat with %s (iso-8859-1 encoding)' '\n+\tgit config i18n.logOutputEncoding iso-8859-1 &&\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\tgit config --unset i18n.logOutputEncoding &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n+test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n test_expect_success 'alias user-defined tformat' '\n \tgit log --pretty=\"tformat:%h\" >expected &&\n \tgit config pretty.test-alias \"tformat:%h\" &&\n@@ -71,22 +108,22 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_success 'NUL separation' '\n-\tprintf \"add bar\\0initial\" >expected &&\n+test_expect_failure 'NUL separation' '\n+\tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL termination' '\n-\tprintf \"add bar\\0initial\\0\" >expected &&\n+test_expect_failure 'NUL termination' '\n+\tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL separation with --stat' '\n+test_expect_failure 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n \tgit log -z --stat --pretty=\"format:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -94,7 +131,7 @@ test_expect_success 'NUL separation with --stat' '\n test_expect_failure 'NUL termination with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\\0\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n0\" >expected &&\n \tgit log -z --stat --pretty=\"tformat:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -108,20 +145,20 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n-test_expect_success 'left alignment formatting' '\n-\tgit log --pretty=\"format:%<(40)%s\" >actual &&\n+test_expect_failure 'left alignment formatting' \"\n+\tgit log --pretty='format:%<(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n message two                            Z\n message one                            Z\n add bar                                Z\n-initial                                Z\n+$(commit_msg)                    Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting at the nth column' \"\n+test_expect_failure 'left alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -129,77 +166,77 @@ test_expect_success 'left alignment formatting at the nth column' \"\n $head1 message two                    Z\n $head2 message one                    Z\n $head3 add bar                        Z\n-$head4 initial                        Z\n+$head4 $(commit_msg)            Z\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'left alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%<(1)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with no padding' \"\n+\tgit log --pretty='format:%<(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with trunc' '\n-\tgit log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with trunc' \"\n+\tgit log --pretty='format:%<(10,trunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n message ..\n message ..\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"8\" \".\\+$\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with ltrunc' '\n-\tgit log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with ltrunc' \"\n+\tgit log --pretty='format:%<(10,ltrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n ..sage two\n ..sage one\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"0\" \".\\{11\\}\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left alignment formatting with mtrunc' '\n-\tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n+test_expect_failure 'left alignment formatting with mtrunc' \"\n+\tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n mess.. two\n mess.. one\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"4\" \".\\{11\\}\")\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'right alignment formatting' '\n-\tgit log --pretty=\"format:%>(40)%s\" >actual &&\n+test_expect_failure 'right alignment formatting' \"\n+\tgit log --pretty='format:%>(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n Z                            message two\n Z                            message one\n Z                                add bar\n-Z                                initial\n+Z                    $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'right alignment formatting at the nth column' \"\n+test_expect_failure 'right alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -207,38 +244,38 @@ test_expect_success 'right alignment formatting at the nth column' \"\n $head1                      message two\n $head2                      message one\n $head3                          add bar\n-$head4                          initial\n+$head4              $(commit_msg)\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'right alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%>(1)%s\" >actual &&\n+test_expect_failure 'right alignment formatting with no padding' \"\n+\tgit log --pretty='format:%>(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'center alignment formatting' '\n-\tgit log --pretty=\"format:%><(40)%s\" >actual &&\n+test_expect_failure 'center alignment formatting' \"\n+\tgit log --pretty='format:%><(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n Z             message two              Z\n Z             message one              Z\n Z               add bar                Z\n-Z               initial                Z\n+Z         $(commit_msg)          Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'center alignment formatting at the nth column' \"\n+test_expect_failure 'center alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -246,36 +283,36 @@ test_expect_success 'center alignment formatting at the nth column' \"\n $head1           message two          Z\n $head2           message one          Z\n $head3             add bar            Z\n-$head4             initial            Z\n+$head4       $(commit_msg)      Z\n EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_success 'center alignment formatting with no padding' '\n-\tgit log --pretty=\"format:%><(1)%s\" >actual &&\n+test_expect_failure 'center alignment formatting with no padding' \"\n+\tgit log --pretty='format:%><(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n-test_expect_success 'left/right alignment formatting with stealing' '\n-\tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n-\tgit log --pretty=\"format:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n+test_expect_failure 'left/right alignment formatting with stealing' \"\n+\tgit commit --amend -m short --author 'long long long <long@me.com>' &&\n+\tgit log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tcat <<\\EOF >expected &&\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n-initial      A U Thor\n+$(commit_msg \"\" \"8\" \".\\+$\")   A U Thor\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_done\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex cc1008d..c66a07f 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -1,34 +1,60 @@\n #!/bin/sh\n \n+# Copyright (c) 2009 Jens Lehmann\n+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n+\n test_description='git rev-list --pretty=format test'\n \n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-terminal.sh\n \n test_tick\n+# String \"added\" in German (translated with Google Translate), encoded in UTF-8,\n+# used as a commit log message below.\n+added=$(printf \"added (hinzugef\\303\\274gt) foo\")\n+added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t iso-8859-1)\n+# same but \"changed\"\n+changed=$(printf \"changed (ge\\303\\244ndert) foo\")\n+changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t iso-8859-1)\n+\n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n-\tgit commit -m \"added foo\" &&\n+\tgit config i18n.commitEncoding iso-8859-1 &&\n+\tgit commit -m \"$added_iso88591\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_short=$(git rev-parse --verify --short $head1) &&\n \ttree1=$(git rev-parse --verify HEAD:) &&\n \ttree1_short=$(git rev-parse --verify --short $tree1) &&\n-\techo changed >foo &&\n-\tgit commit -a -m \"changed foo\" &&\n+\techo \"$changed\" > foo &&\n+\tgit commit -a -m \"$changed_iso88591\" &&\n \thead2=$(git rev-parse --verify HEAD) &&\n \thead2_short=$(git rev-parse --verify --short $head2) &&\n \ttree2=$(git rev-parse --verify HEAD:) &&\n \ttree2_short=$(git rev-parse --verify --short $tree2)\n+\tgit config --unset i18n.commitEncoding\n '\n \n-# usage: test_format name format_string <expected_output\n+# usage: test_format [failure] name format_string <expected_output\n test_format () {\n+\tmust_fail=0\n+\t# if parameters count is more than 2 then test must fail\n+\tif test $# -gt 2\n+\tthen\n+\t\tmust_fail=1\n+\t\t# remove first parameter which is flag for test failure\n+\t\tshift\n+\tfi\n \tcat >expect.$1\n-\ttest_expect_success \"format $1\" \"\n-\t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n-\t\ttest_cmp expect.$1 output.$1\n-\t\"\n+\tname=\"format $1\"\n+\tcommand=\"git rev-list --pretty=format:'$2' master >output.$1 &&\n+\t\ttest_cmp expect.$1 output.$1\"\n+\tif test $must_fail -eq 1\n+\tthen\n+\t\ttest_expect_failure \"$name\" \"$command\"\n+\telse\n+\t\ttest_expect_success \"$name\" \"$command\"\n+\tfi\n }\n \n # Feed to --format to provide predictable colored sequences.\n@@ -110,14 +136,16 @@ EOF\n \n test_format encoding %e <<EOF\n commit $head2\n+iso-8859-1\n commit $head1\n+iso-8859-1\n EOF\n \n-test_format subject %s <<EOF\n+test_format failure subject %s <<EOF\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n test_format body %b <<EOF\n@@ -125,12 +153,12 @@ commit $head2\n commit $head1\n EOF\n \n-test_format raw-body %B <<EOF\n+test_format failure raw-body %B <<EOF\n commit $head2\n-changed foo\n+$changed\n \n commit $head1\n-added foo\n+$added\n \n EOF\n \n@@ -190,42 +218,49 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '\n \t)\n '\n \n-cat >commit-msg <<'EOF'\n+iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF\n Test printing of complex bodies\n \n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: �bueno!\n+include an iso8859 character: ¡bueno!\n EOF\n \n test_expect_success 'setup complex body' '\n \tgit config i18n.commitencoding iso8859-1 &&\n \techo change2 >foo && git commit -a -F commit-msg &&\n \thead3=$(git rev-parse --verify HEAD) &&\n-\thead3_short=$(git rev-parse --short $head3)\n+\thead3_short=$(git rev-parse --short $head3) &&\n+\t# unset commit encoding config\n+\t# otherwise %e does not print encoding value\n+\t# and following test fails\n+\tgit config --unset i18n.commitEncoding\n+\n '\n \n test_format complex-encoding %e <<EOF\n commit $head3\n iso8859-1\n commit $head2\n+iso-8859-1\n commit $head1\n+iso-8859-1\n EOF\n \n-test_format complex-subject %s <<EOF\n+test_format failure complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n-test_format complex-body %b <<EOF\n+test_format failure complex-body %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: �bueno!\n+include an iso8859 character: ¡bueno!\n \n commit $head2\n commit $head1\n@@ -279,12 +314,12 @@ test_expect_success 'add LF before non-empty (2)' '\n \n test_expect_success 'add SP before non-empty (1)' '\n \tgit show -s --pretty=format:\"%s% bThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 2\n+\ttest $(wc -w <actual) = 3\n '\n \n test_expect_success 'add SP before non-empty (2)' '\n \tgit show -s --pretty=format:\"%s% sThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 4\n+\ttest $(wc -w <actual) = 6\n '\n \n test_expect_success '--abbrev' '\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 05dfb27..72e364e 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -9,6 +9,17 @@ Documented tests for git reset'\n \n . ./test-lib.sh\n \n+commit_msg() {\n+\t# String \"modify 2nd file (changed)\" partly in German(translated with Google Translate),\n+\t# encoded in UTF-8, used as a commit log message below.\n+\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n+\tif test -n \"$1\"\n+\tthen\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'creating initial files and commits' '\n \ttest_tick &&\n \techo \"1st file\" >first &&\n@@ -28,7 +39,7 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=iso-8859-1\" commit -a -m \"$(commit_msg iso-8859-1)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -44,6 +55,20 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n+test_expect_failure 'reset --hard message' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg) > .expected &&\n+\ttest_cmp .expected .actual\n+'\n+\n+test_expect_success 'reset --hard message (iso-8859-1 logoutencoding)' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit -c \"i18n.logOutputEncoding=iso-8859-1\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg iso-8859-1) > .expected &&\n+\ttest_cmp .expected .actual\n+'\n+\n >.diff_expect\n >.cached_expect\n cat >.cat_expect <<EOF\n@@ -304,7 +329,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=iso-8859-1\" commit -a -m \"$(commit_msg iso-8859-1)\" &&\n \tcheck_changes $head5\n '\n \n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222017","messageId":"aa95cf382f3184e50143391b843b31248284dbd0.1372240999.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372240998.git.Alex.Crezoff@gmail.com","subject":"[PATCH v7 5/5] pretty: --format output should honor logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-06-26T10:19:50Z","receivedAt":"2013-06-26T10:19:50Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"One can set an alias\n\t$ git config [--global] alias.lg \"log --graph --pretty=format:'%Cred%h%Creset\n\t-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset'\n\t--abbrev-commit --date=local\"\n\nto see the log as a pretty tree (like *gitk* but in a terminal).\n\nHowever, log messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted even when i18n.logOutputEncoding\nand terminal encoding are the same (e.g. log messages committed on a Cygwin box\nwith Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa).\n\nTo simplify an example we can say the following two commands are expected\nto give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it formats \"%s\".\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nThis patch makes pretty --format honor logOutputEncoding when it formats\nlog message.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n builtin/reset.c                  |  5 ++++-\n builtin/rev-list.c               |  1 +\n builtin/shortlog.c               |  1 +\n log-tree.c                       |  1 +\n submodule.c                      |  1 +\n t/t4041-diff-submodule-option.sh | 10 +++++-----\n t/t4205-log-pretty-formats.sh    | 34 +++++++++++++++++-----------------\n t/t6006-rev-list-format.sh       |  8 ++++----\n t/t7102-reset.sh                 |  2 +-\n 9 files changed, 35 insertions(+), 28 deletions(-)\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 6032131..afa6e02 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -93,10 +93,12 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet)\n static void print_new_head_line(struct commit *commit)\n {\n \tconst char *hex, *body;\n+\tchar *msg;\n \n \thex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);\n \tprintf(_(\"HEAD is now at %s\"), hex);\n-\tbody = strstr(commit->buffer, \"\\n\\n\");\n+\tmsg = logmsg_reencode(commit, NULL, get_log_output_encoding());\n+\tbody = strstr(msg, \"\\n\\n\");\n \tif (body) {\n \t\tconst char *eol;\n \t\tsize_t len;\n@@ -107,6 +109,7 @@ static void print_new_head_line(struct commit *commit)\n \t}\n \telse\n \t\tprintf(\"\\n\");\n+\tlogmsg_free(msg, commit);\n }\n \n static void update_index_from_diff(struct diff_queue_struct *q,\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 67701be..a5ec30d 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -111,6 +111,7 @@ static void show_commit(struct commit *commit, void *data)\n \t\tctx.date_mode = revs->date_mode;\n \t\tctx.date_mode_explicit = revs->date_mode_explicit;\n \t\tctx.fmt = revs->commit_format;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &buf);\n \t\tif (revs->graph) {\n \t\t\tif (buf.len) {\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 1fd6f8a..1434f8f 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -137,6 +137,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n \t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &ufbuf);\n \t\tbuffer = ufbuf.buf;\n \t} else if (*buffer) {\ndiff --git a/log-tree.c b/log-tree.c\nindex 1946e9c..5277d3e 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -616,6 +616,7 @@ void show_log(struct rev_info *opt)\n \tctx.fmt = opt->commit_format;\n \tctx.mailmap = opt->mailmap;\n \tctx.color = opt->diffopt.use_color;\n+\tctx.output_encoding = get_log_output_encoding();\n \tpretty_print_commit(&ctx, commit, &msgbuf);\n \n \tif (opt->add_signoff)\ndiff --git a/submodule.c b/submodule.c\nindex 1821a5b..78734e1 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -226,6 +226,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,\n \twhile ((commit = get_revision(rev))) {\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode = rev->date_mode;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tstrbuf_setlen(&sb, 0);\n \t\tstrbuf_addstr(&sb, line_prefix);\n \t\tif (commit->object.flags & SYMMETRIC_LEFT) {\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 2a7877d..0a4f496 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -94,7 +94,7 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -103,7 +103,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -112,7 +112,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward) --submodule' '\n+test_expect_success 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -143,7 +143,7 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_failure 'modified submodule(backward)' '\n+test_expect_success 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n@@ -154,7 +154,7 @@ test_expect_failure 'modified submodule(backward)' '\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_failure 'modified submodule(backward and forward)' '\n+test_expect_success 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 6b62da2..2fc9674 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -69,7 +69,7 @@ test_expect_success 'alias user-defined tformat with %s (iso-8859-1 encoding)' '\n \ttest_cmp expected-s actual-s\n '\n \n-test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+test_expect_success 'alias user-defined tformat with %s (utf-8 encoding)' '\n \tgit log --oneline >expected-s &&\n \tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n \ttest_cmp expected-s actual-s\n@@ -108,19 +108,19 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_failure 'NUL separation' '\n+test_expect_success 'NUL separation' '\n \tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL termination' '\n+test_expect_success 'NUL termination' '\n \tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL separation with --stat' '\n+test_expect_success 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n \tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n@@ -145,7 +145,7 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n-test_expect_failure 'left alignment formatting' \"\n+test_expect_success 'left alignment formatting' \"\n \tgit log --pretty='format:%<(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -158,7 +158,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting at the nth column' \"\n+test_expect_success 'left alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -171,7 +171,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with no padding' \"\n+test_expect_success 'left alignment formatting with no padding' \"\n \tgit log --pretty='format:%<(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -184,7 +184,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with trunc' \"\n+test_expect_success 'left alignment formatting with trunc' \"\n \tgit log --pretty='format:%<(10,trunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -197,7 +197,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with ltrunc' \"\n+test_expect_success 'left alignment formatting with ltrunc' \"\n \tgit log --pretty='format:%<(10,ltrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -210,7 +210,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left alignment formatting with mtrunc' \"\n+test_expect_success 'left alignment formatting with mtrunc' \"\n \tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -223,7 +223,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting' \"\n+test_expect_success 'right alignment formatting' \"\n \tgit log --pretty='format:%>(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -236,7 +236,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting at the nth column' \"\n+test_expect_success 'right alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -249,7 +249,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'right alignment formatting with no padding' \"\n+test_expect_success 'right alignment formatting with no padding' \"\n \tgit log --pretty='format:%>(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -262,7 +262,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting' \"\n+test_expect_success 'center alignment formatting' \"\n \tgit log --pretty='format:%><(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -275,7 +275,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting at the nth column' \"\n+test_expect_success 'center alignment formatting at the nth column' \"\n \tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -288,7 +288,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'center alignment formatting with no padding' \"\n+test_expect_success 'center alignment formatting with no padding' \"\n \tgit log --pretty='format:%><(1)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -301,7 +301,7 @@ EOF\n \ttest_cmp expected actual\n \"\n \n-test_expect_failure 'left/right alignment formatting with stealing' \"\n+test_expect_success 'left/right alignment formatting with stealing' \"\n \tgit commit --amend -m short --author 'long long long <long@me.com>' &&\n \tgit log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&\n \t# complete the incomplete line at the end\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex c66a07f..380c85b 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -141,7 +141,7 @@ commit $head1\n iso-8859-1\n EOF\n \n-test_format failure subject %s <<EOF\n+test_format subject %s <<EOF\n commit $head2\n $changed\n commit $head1\n@@ -153,7 +153,7 @@ commit $head2\n commit $head1\n EOF\n \n-test_format failure raw-body %B <<EOF\n+test_format raw-body %B <<EOF\n commit $head2\n $changed\n \n@@ -247,7 +247,7 @@ commit $head1\n iso-8859-1\n EOF\n \n-test_format failure complex-subject %s <<EOF\n+test_format complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n@@ -256,7 +256,7 @@ commit $head1\n $added\n EOF\n \n-test_format failure complex-body %b <<EOF\n+test_format complex-body %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 72e364e..27b1e93 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -55,7 +55,7 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n-test_expect_failure 'reset --hard message' '\n+test_expect_success 'reset --hard message' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg) > .expected &&\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222019","messageId":"7v38s5ymo9.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"20130626073423.GA23688@ashu.dyn1.rarus.ru","subject":"Re: [PATCH v6 0/5] Reroll patches against v1.8.3.1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-26T14:24:54Z","receivedAt":"2013-06-26T14:24:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> On Tue, Jun 25, 2013 at 12:28:02PM -0700, Junio C Hamano wrote:\n> ...\n> If someone can do the same with latin1, I'd be happy.\n> ...\n> But today I've taken a look to Cygwin's locales more closely and found\n> out that I've used incorrect encoding name (`iso88595` instead of \"canonic\"\n> `iso-8859-5` that Cygwin has and \"understands\")\n>\n> Nevertheless, as I've already said that is not a Russian locale specific\n> issue.\n> The problem in tests for me now is a language (that uses iso-8859-1\n> encoding) I do not speak or even write ;)\n\nMany of the people on thee list don't, either, and that is perfectly\nOK.\n\nFor the purpose of the test, \"áëîõù\" should be sufficient. In a\nsense, using such an artificial string would make it even clearer\nthan a real message that what we are testing, no?\n"},{"id":"222024","messageId":"7vehboyhd2.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"cover.1372240998.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v7 0/5] Reroll patches against v1.8.3.1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-26T16:19:37Z","receivedAt":"2013-06-26T16:19:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n\n> v7 of this patch series includes the following changes against v6:\n> 1. [PATCH v7 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n> \tuntouched\n> 2. [PATCH v7 2/5] t7102 (reset): don't hardcode SHA-1 in expected outputs\n> \tuntouched\n> 3. [PATCH v7 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n> \tuntouched\n> 4. [PATCH v7 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding\n>     cp1251 encoding changed to iso-8859-1 encoding already used in tests\n>     Test commit messages contain words (\"changed\" and \"added\") in German\n>     (which is covered by iso-8859-1 encoding)\n>     They are translated from English (verified in Russian) with Google Translate\n> 5. [PATCH v7 5/5] pretty: --format output should honor logOutputEncoding\n>     builtin/reset.c:\n>         \"const char ..., *msg;\" declaration replaced with \"char *msg;\"\n>         to avoid compiler warning on the line \"logmsg_free(msg, commit);\"\n>\n> P.S.\n> It's all started here [http://thread.gmane.org/gmane.comp.version-control.git/177634]\n\nThanks for a quick reroll and reference to previous threads in the\ncover letter.\n"},{"id":"222266","messageId":"51D12927.5050000@viscovery.net","threadId":"28440","inReplyTo":"9e83de68067be7548c0119d6e99caa905fab0c0f.1372240999.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v7 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-07-01T07:00:55Z","receivedAt":"2013-07-01T07:00:55Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/26/2013 12:19, schrieb Alexey Shumkin:\n> One can set an alias\n> \t$ git config alias.lg \"log --graph --pretty=format:'%Cred%h%Creset\n> \t-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset'\n> \t--abbrev-commit --date=local\"\n> \n> to see the log as a pretty tree (like *gitk* but in a terminal).\n> \n> However, log messages written in an encoding i18n.commitEncoding which differs\n> from terminal encoding are shown corrupted even when i18n.logOutputEncoding\n> and terminal encoding are the same (e.g. log messages committed on a Cygwin box\n> with Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa).\n> \n> To simplify an example we can say the following two commands are expected\n> to give the same output to a terminal:\n> \n> \t$ git log --oneline --no-color\n> \t$ git log --pretty=format:'%h %s'\n> \n> However, the former pays attention to i18n.logOutputEncoding\n> configuration, while the latter does not when it formats \"%s\".\n> \n> The same corruption is true for\n> \t$ git diff --submodule=log\n> and\n> \t$ git rev-list --pretty=format:%s HEAD\n> and\n> \t$ git reset --hard\n> \n> This patch adds failing tests for the next patch that fixes them.\n> \n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n\n> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> index 73ba5e8..6b62da2 100755\n> --- a/t/t4205-log-pretty-formats.sh\n> +++ b/t/t4205-log-pretty-formats.sh\n...\n> +commit_msg() {\n> +\t# String \"initial. initial\" partly in German (translated with Google Translate),\n> +\t# encoded in UTF-8, used as a commit log message below.\n> +\tmsg=$(printf \"initial. anf\\303\\244nglich\")\n> +\tif test -n \"$1\"\n> +\tthen\n> +\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n> +\tfi\n> +\tif test -n \"$2\" -a -n \"$3\"\n> +\tthen\n> +\t\t# cut string, replace cut part with two dots\n> +\t\t# $2 - chars count from the beginning of the string\n> +\t\t# $3 - \"trailing\" chars\n> +\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n> +\t\t# as it does with C locale\n> +\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n\nThis does not work as expected on Windows because sed ignores the .UTF-8\npart of the locale specifier. (We don't even have en_US; we have de, but\nwith de.UTF-8 this doesn't work, either.)\n\nI don't have an idea, yet, how to work it around.\n\n> +\tfi\n> +\techo $msg\n> +}\n\n> -test_expect_success 'left alignment formatting with mtrunc' '\n> -\tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n> +test_expect_failure 'left alignment formatting with mtrunc' \"\n> +\tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n>  \t# complete the incomplete line at the end\n>  \techo >>actual &&\n>  \tqz_to_tab_space <<\\EOF >expected &&\n>  mess.. two\n>  mess.. one\n>  add bar  Z\n> -initial  Z\n> +$(commit_msg \"\" \"4\" \".\\{11\\}\")\n>  EOF\n>  \ttest_cmp expected actual\n> -'\n> +\"\n\nThis is the failing test case.\n\nBTW, if you re-roll, there would be fewer changes needed if you kept the\ntest code single-quoted, but changed <<\\EOF to <<EOF where needed.\n\n> diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> index cc1008d..c66a07f 100755\n> --- a/t/t6006-rev-list-format.sh\n> +++ b/t/t6006-rev-list-format.sh\n...\n>  test_expect_success 'setup' '\n>  \t: >foo &&\n>  \tgit add foo &&\n> -\tgit commit -m \"added foo\" &&\n> +\tgit config i18n.commitEncoding iso-8859-1 &&\n\nPerhaps\n\ttest_config i18n.commitEncoding iso-8859-1 &&\n\nAlso, it is \"iso-8869-1\" here, but we see \"iso8859-1\" already used later.\nIt's probably wise to use that same encoding name everywhere because we\ncan be very sure that the latter is already understood on all supported\nplatforms.\n\n> +\tgit commit -m \"$added_iso88591\" &&\n>  \thead1=$(git rev-parse --verify HEAD) &&\n>  \thead1_short=$(git rev-parse --verify --short $head1) &&\n>  \ttree1=$(git rev-parse --verify HEAD:) &&\n>  \ttree1_short=$(git rev-parse --verify --short $tree1) &&\n> -\techo changed >foo &&\n> -\tgit commit -a -m \"changed foo\" &&\n> +\techo \"$changed\" > foo &&\n> +\tgit commit -a -m \"$changed_iso88591\" &&\n>  \thead2=$(git rev-parse --verify HEAD) &&\n>  \thead2_short=$(git rev-parse --verify --short $head2) &&\n>  \ttree2=$(git rev-parse --verify HEAD:) &&\n>  \ttree2_short=$(git rev-parse --verify --short $tree2)\n> +\tgit config --unset i18n.commitEncoding\n>  '\n>  \n> -# usage: test_format name format_string <expected_output\n> +# usage: test_format [failure] name format_string <expected_output\n>  test_format () {\n> +\tmust_fail=0\n> +\t# if parameters count is more than 2 then test must fail\n> +\tif test $# -gt 2\n> +\tthen\n> +\t\tmust_fail=1\n> +\t\t# remove first parameter which is flag for test failure\n> +\t\tshift\n> +\tfi\n>  \tcat >expect.$1\n> -\ttest_expect_success \"format $1\" \"\n> -\t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n> -\t\ttest_cmp expect.$1 output.$1\n> -\t\"\n> +\tname=\"format $1\"\n> +\tcommand=\"git rev-list --pretty=format:'$2' master >output.$1 &&\n> +\t\ttest_cmp expect.$1 output.$1\"\n> +\tif test $must_fail -eq 1\n> +\tthen\n> +\t\ttest_expect_failure \"$name\" \"$command\"\n> +\telse\n> +\t\ttest_expect_success \"$name\" \"$command\"\n> +\tfi\n>  }\n\nThis function would be much shorter with the optional \"failure\" token as\n$3 (untested):\n\ntest_format () {\n\tcat >expect.$1\n\ttest_expect_${3:-success} \"format $1\" \"\n\t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n\t\ttest_cmp expect.$1 output.$1\n\t\"\n}\n\n>  test_expect_success 'setup complex body' '\n>  \tgit config i18n.commitencoding iso8859-1 &&\n>  \techo change2 >foo && git commit -a -F commit-msg &&\n>  \thead3=$(git rev-parse --verify HEAD) &&\n> -\thead3_short=$(git rev-parse --short $head3)\n> +\thead3_short=$(git rev-parse --short $head3) &&\n> +\t# unset commit encoding config\n> +\t# otherwise %e does not print encoding value\n> +\t# and following test fails\n\nI don't understand this comment. The test vector below already shows that\nan encoding is printed. Why would this suddenly be different with the\nupdated tests?\n\nAssuming that this change doesn't sweep a deeper problem under the rug,\nit's better to use test_config a few lines earlier.\n\n> +\tgit config --unset i18n.commitEncoding\n> +\n>  '\n>  \n>  test_format complex-encoding %e <<EOF\n>  commit $head3\n>  iso8859-1\n\nThis is the encoding that I mean.\n\n>  commit $head2\n> +iso-8859-1\n>  commit $head1\n> +iso-8859-1\n>  EOF\n\n> diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\n> index 05dfb27..72e364e 100755\n> --- a/t/t7102-reset.sh\n> +++ b/t/t7102-reset.sh\n> @@ -9,6 +9,17 @@ Documented tests for git reset'\n>  \n>  . ./test-lib.sh\n>  \n> +commit_msg() {\n> +\t# String \"modify 2nd file (changed)\" partly in German(translated with Google Translate),\n> +\t# encoded in UTF-8, used as a commit log message below.\n> +\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n> +\tif test -n \"$1\"\n> +\tthen\n> +\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n> +\tfi\n> +\techo $msg\n> +}\n\nIf you wanted to, you could write this as\n\ncommit_msg () {\n\t# String \"modify 2nd file (changed)\" partly in German\n\t#(translated with Google Translate),\n\t# encoded in UTF-8, used as a commit log message below.\n\tprintf \"modify 2nd file (ge\\303\\244ndert)\" |\n\tif test -n \"$1\"\n\tthen\n\t\ticonv -f utf-8 -t $1\n\telse\n\t\tcat\n\tfi\n}\n\nbut I'm not sure whether it's a lot better.\n\n-- Hannes\n"},{"id":"222321","messageId":"20130701225013.GA17377@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"51D12927.5050000@viscovery.net","subject":"Re: [PATCH v7 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-01T22:50:13Z","receivedAt":"2013-07-01T22:50:13Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Mon, Jul 01, 2013 at 09:00:55AM +0200, Johannes Sixt wrote:\n> Am 6/26/2013 12:19, schrieb Alexey Shumkin:\n> > One can set an alias\n> > \t$ git config alias.lg \"log --graph --pretty=format:'%Cred%h%Creset\n> > \t-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset'\n> > \t--abbrev-commit --date=local\"\n> > \n> > to see the log as a pretty tree (like *gitk* but in a terminal).\n> > \n> > However, log messages written in an encoding i18n.commitEncoding which differs\n> > from terminal encoding are shown corrupted even when i18n.logOutputEncoding\n> > and terminal encoding are the same (e.g. log messages committed on a Cygwin box\n> > with Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa).\n> > \n> > To simplify an example we can say the following two commands are expected\n> > to give the same output to a terminal:\n> > \n> > \t$ git log --oneline --no-color\n> > \t$ git log --pretty=format:'%h %s'\n> > \n> > However, the former pays attention to i18n.logOutputEncoding\n> > configuration, while the latter does not when it formats \"%s\".\n> > \n> > The same corruption is true for\n> > \t$ git diff --submodule=log\n> > and\n> > \t$ git rev-list --pretty=format:%s HEAD\n> > and\n> > \t$ git reset --hard\n> > \n> > This patch adds failing tests for the next patch that fixes them.\n> > \n> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> \n> > diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> > index 73ba5e8..6b62da2 100755\n> > --- a/t/t4205-log-pretty-formats.sh\n> > +++ b/t/t4205-log-pretty-formats.sh\n> ...\n> > +commit_msg() {\n> > +\t# String \"initial. initial\" partly in German (translated with Google Translate),\n> > +\t# encoded in UTF-8, used as a commit log message below.\n> > +\tmsg=$(printf \"initial. anf\\303\\244nglich\")\n> > +\tif test -n \"$1\"\n> > +\tthen\n> > +\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n> > +\tfi\n> > +\tif test -n \"$2\" -a -n \"$3\"\n> > +\tthen\n> > +\t\t# cut string, replace cut part with two dots\n> > +\t\t# $2 - chars count from the beginning of the string\n> > +\t\t# $3 - \"trailing\" chars\n> > +\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n> > +\t\t# as it does with C locale\n> > +\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n> \n> This does not work as expected on Windows because sed ignores the .UTF-8\n> part of the locale specifier. (We don't even have en_US; we have de, but\n> with de.UTF-8 this doesn't work, either.)\n> \n> I don't have an idea, yet, how to work it around.\n> \nHmm. I have Cygwin v1.7 (on Windows 7 and Windows 2003 Server R2)\nwith many locales installed (and with en_US.UTF-8 locale, too)\nToday I could not find a way to run tests with \"no en_US.UTF-8 locale installed\" simulation\nto test your failure\n> > +\tfi\n> > +\techo $msg\n> > +}\n> \n> > -test_expect_success 'left alignment formatting with mtrunc' '\n> > -\tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n> > +test_expect_failure 'left alignment formatting with mtrunc' \"\n> > +\tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n> >  \t# complete the incomplete line at the end\n> >  \techo >>actual &&\n> >  \tqz_to_tab_space <<\\EOF >expected &&\n> >  mess.. two\n> >  mess.. one\n> >  add bar  Z\n> > -initial  Z\n> > +$(commit_msg \"\" \"4\" \".\\{11\\}\")\n> >  EOF\n> >  \ttest_cmp expected actual\n> > -'\n> > +\"\n> \n> This is the failing test case.\nHmm, for me all these tests pass on both Linux and Cygwin (mentioned\nabove) boxes\n> \n> BTW, if you re-roll, there would be fewer changes needed if you kept the\n> test code single-quoted, but changed <<\\EOF to <<EOF where needed.\nYep, thanks for your correction\n\n> \n> > diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\n> > index cc1008d..c66a07f 100755\n> > --- a/t/t6006-rev-list-format.sh\n> > +++ b/t/t6006-rev-list-format.sh\n> ...\n> >  test_expect_success 'setup' '\n> >  \t: >foo &&\n> >  \tgit add foo &&\n> > -\tgit commit -m \"added foo\" &&\n> > +\tgit config i18n.commitEncoding iso-8859-1 &&\n> \n> Perhaps\n> \ttest_config i18n.commitEncoding iso-8859-1 &&\n> \n> Also, it is \"iso-8869-1\" here, but we see \"iso8859-1\" already used later.\n> It's probably wise to use that same encoding name everywhere because we\n> can be very sure that the latter is already understood on all supported\n> platforms.\nYou're right (I've looked at explanation in\n3994e8a98dc7bbf67e61d23c8125f44383499a1f; I've thought ISO-8859-1 is a\ncommon name).\n> \n> > +\tgit commit -m \"$added_iso88591\" &&\n> >  \thead1=$(git rev-parse --verify HEAD) &&\n> >  \thead1_short=$(git rev-parse --verify --short $head1) &&\n> >  \ttree1=$(git rev-parse --verify HEAD:) &&\n> >  \ttree1_short=$(git rev-parse --verify --short $tree1) &&\n> > -\techo changed >foo &&\n> > -\tgit commit -a -m \"changed foo\" &&\n> > +\techo \"$changed\" > foo &&\n> > +\tgit commit -a -m \"$changed_iso88591\" &&\n> >  \thead2=$(git rev-parse --verify HEAD) &&\n> >  \thead2_short=$(git rev-parse --verify --short $head2) &&\n> >  \ttree2=$(git rev-parse --verify HEAD:) &&\n> >  \ttree2_short=$(git rev-parse --verify --short $tree2)\n> > +\tgit config --unset i18n.commitEncoding\n> >  '\n> >  \n> > -# usage: test_format name format_string <expected_output\n> > +# usage: test_format [failure] name format_string <expected_output\n> >  test_format () {\n> > +\tmust_fail=0\n> > +\t# if parameters count is more than 2 then test must fail\n> > +\tif test $# -gt 2\n> > +\tthen\n> > +\t\tmust_fail=1\n> > +\t\t# remove first parameter which is flag for test failure\n> > +\t\tshift\n> > +\tfi\n> >  \tcat >expect.$1\n> > -\ttest_expect_success \"format $1\" \"\n> > -\t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n> > -\t\ttest_cmp expect.$1 output.$1\n> > -\t\"\n> > +\tname=\"format $1\"\n> > +\tcommand=\"git rev-list --pretty=format:'$2' master >output.$1 &&\n> > +\t\ttest_cmp expect.$1 output.$1\"\n> > +\tif test $must_fail -eq 1\n> > +\tthen\n> > +\t\ttest_expect_failure \"$name\" \"$command\"\n> > +\telse\n> > +\t\ttest_expect_success \"$name\" \"$command\"\n> > +\tfi\n> >  }\n> \n> This function would be much shorter with the optional \"failure\" token as\n> $3 (untested):\n> \n> test_format () {\n> \tcat >expect.$1\n> \ttest_expect_${3:-success} \"format $1\" \"\n> \t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n> \t\ttest_cmp expect.$1 output.$1\n> \t\"\nThank you for your suggesstion\n> }\n> \n> >  test_expect_success 'setup complex body' '\n> >  \tgit config i18n.commitencoding iso8859-1 &&\n> >  \techo change2 >foo && git commit -a -F commit-msg &&\n> >  \thead3=$(git rev-parse --verify HEAD) &&\n> > -\thead3_short=$(git rev-parse --short $head3)\n> > +\thead3_short=$(git rev-parse --short $head3) &&\n> > +\t# unset commit encoding config\n> > +\t# otherwise %e does not print encoding value\n> > +\t# and following test fails\n> \n> I don't understand this comment. The test vector below already shows that\n> an encoding is printed. Why would this suddenly be different with the\n> updated tests?\nI've changed tests. I've reverted back these ones, and added\nnew ones with no i18n.commitEncoding set\n> \n> Assuming that this change doesn't sweep a deeper problem under the rug,\n> it's better to use test_config a few lines earlier.\n> \n> > +\tgit config --unset i18n.commitEncoding\n> > +\n> >  '\n> >  \n> >  test_format complex-encoding %e <<EOF\n> >  commit $head3\n> >  iso8859-1\n> \n> This is the encoding that I mean.\nThese encodings \"have appeared\" because we've changed 'setup':\nwe make commits with i18n.commitEncoding set\n> \n> >  commit $head2\n> > +iso-8859-1\n> >  commit $head1\n> > +iso-8859-1\n> >  EOF\n> \n> > diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\n> > index 05dfb27..72e364e 100755\n> > --- a/t/t7102-reset.sh\n> > +++ b/t/t7102-reset.sh\n> > @@ -9,6 +9,17 @@ Documented tests for git reset'\n> >  \n> >  . ./test-lib.sh\n> >  \n> > +commit_msg() {\n> > +\t# String \"modify 2nd file (changed)\" partly in German(translated with Google Translate),\n> > +\t# encoded in UTF-8, used as a commit log message below.\n> > +\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n> > +\tif test -n \"$1\"\n> > +\tthen\n> > +\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n> > +\tfi\n> > +\techo $msg\n> > +}\n> \n> If you wanted to, you could write this as\n> \n> commit_msg () {\n> \t# String \"modify 2nd file (changed)\" partly in German\n> \t#(translated with Google Translate),\n> \t# encoded in UTF-8, used as a commit log message below.\n> \tprintf \"modify 2nd file (ge\\303\\244ndert)\" |\n> \tif test -n \"$1\"\n> \tthen\n> \t\ticonv -f utf-8 -t $1\n> \telse\n> \t\tcat\n> \tfi\n> }\n> \n> but I'm not sure whether it's a lot better.\nIt looks more readable. Thank you\n> \n> -- Hannes\n\n-- \nAlexey Shumkin\n"},{"id":"222323","messageId":"cover.1372719264.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372240998.git.Alex.Crezoff@gmail.com","subject":"[PATCH v8 0/5] Reroll patches against Git v1.8.3.2","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-01T23:18:59Z","receivedAt":"2013-07-01T23:18:59Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"v8 of this patch series includes the following changes against v7:\n1. [PATCH v8 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n        untouched\n2. [PATCH v8 2/5] t7102 (reset): don't hardcode SHA-1 in expected outputs\n        untouched\n3. [PATCH v8 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n        untouched\n4. [PATCH v8 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding\n    Includes suggestions of Johannes Sixt:\n    iso-8859-1 encoding replaced with its more \"ancient\" synonym \"iso8859-1\" already used in tests\n    t/t6006-rev-list-format.sh:\n       `test_format` function become simplier and more readable \n       `complex body` & `complex subject` tests are reverted back (to its \"initial\" state)\n       2 tests added to test encoding conversions with i18n.commitEncoding unset\n    t/t7102-reset.sh:\n       `commit_msg` function become more readable\n\n5. [PATCH v8 5/5] pretty: --format output should honor logOutputEncoding \n    untouched\n\nP.S.\nIt's all started here [http://thread.gmane.org/gmane.comp.version-control.git/177634]\n\nAlexey Shumkin (5):\n  t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs\n  t7102 (reset): don't hardcode SHA-1 in expected outputs\n  t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n  pretty: Add failing tests: --format output should honor\n    logOutputEncoding\n  pretty: --format output should honor logOutputEncoding\n\n builtin/reset.c                  |   5 +-\n builtin/rev-list.c               |   1 +\n builtin/shortlog.c               |   1 +\n log-tree.c                       |   1 +\n submodule.c                      |   1 +\n t/t4041-diff-submodule-option.sh |  25 +++--\n t/t4205-log-pretty-formats.sh    | 126 ++++++++++++++++--------\n t/t6006-rev-list-format.sh       | 204 +++++++++++++++++++++++++--------------\n t/t7102-reset.sh                 |  39 +++++++-\n 9 files changed, 270 insertions(+), 133 deletions(-)\n\n-- \n1.8.3.1.16.gce2c52e\n"},{"id":"222324","messageId":"56e165a956f6e146967de61b6eceb344a6a721f9.1372719264.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372719264.git.Alex.Crezoff@gmail.com","subject":"[PATCH v8 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-01T23:19:00Z","receivedAt":"2013-07-01T23:19:00Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t6006-rev-list-format.sh | 140 +++++++++++++++++++++++++--------------------\n 1 file changed, 77 insertions(+), 63 deletions(-)\n\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 0393c9f..cc1008d 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -7,8 +7,19 @@ test_description='git rev-list --pretty=format test'\n \n test_tick\n test_expect_success 'setup' '\n-touch foo && git add foo && git commit -m \"added foo\" &&\n-  echo changed >foo && git commit -a -m \"changed foo\"\n+\t: >foo &&\n+\tgit add foo &&\n+\tgit commit -m \"added foo\" &&\n+\thead1=$(git rev-parse --verify HEAD) &&\n+\thead1_short=$(git rev-parse --verify --short $head1) &&\n+\ttree1=$(git rev-parse --verify HEAD:) &&\n+\ttree1_short=$(git rev-parse --verify --short $tree1) &&\n+\techo changed >foo &&\n+\tgit commit -a -m \"changed foo\" &&\n+\thead2=$(git rev-parse --verify HEAD) &&\n+\thead2_short=$(git rev-parse --verify --short $head2) &&\n+\ttree2=$(git rev-parse --verify HEAD:) &&\n+\ttree2_short=$(git rev-parse --verify --short $tree2)\n '\n \n # usage: test_format name format_string <expected_output\n@@ -32,49 +43,49 @@ has_no_color () {\n \ttest_cmp expect \"$1\"\n }\n \n-test_format percent %%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format percent %%h <<EOF\n+commit $head2\n %h\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n %h\n EOF\n \n-test_format hash %H%n%h <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-131a310eb913d107dd3c09a65d1651175898735d\n-131a310\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n+test_format hash %H%n%h <<EOF\n+commit $head2\n+$head2\n+$head2_short\n+commit $head1\n+$head1\n+$head1_short\n EOF\n \n-test_format tree %T%n%t <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-fe722612f26da5064c32ca3843aa154bdb0b08a0\n-fe72261\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-4d5fcadc293a348e88f777dc0920f11e7d71441c\n-4d5fcad\n+test_format tree %T%n%t <<EOF\n+commit $head2\n+$tree2\n+$tree2_short\n+commit $head1\n+$tree1\n+$tree1_short\n EOF\n \n-test_format parents %P%n%p <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n-86c75cf\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format parents %P%n%p <<EOF\n+commit $head2\n+$head1\n+$head1_short\n+commit $head1\n \n \n EOF\n \n # we don't test relative here\n-test_format author %an%n%ae%n%ad%n%aD%n%at <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format author %an%n%ae%n%ad%n%aD%n%at <<EOF\n+commit $head2\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n A U Thor\n author@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -82,14 +93,14 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<EOF\n+commit $head2\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n C O Mitter\n committer@example.com\n Thu Apr 7 15:13:13 2005 -0700\n@@ -97,43 +108,43 @@ Thu, 7 Apr 2005 15:13:13 -0700\n 1112911993\n EOF\n \n-test_format encoding %e <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format encoding %e <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format subject %s <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format subject %s <<EOF\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format body %b <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+test_format body %b <<EOF\n+commit $head2\n+commit $head1\n EOF\n \n-test_format raw-body %B <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format raw-body %B <<EOF\n+commit $head2\n changed foo\n \n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n \n EOF\n \n-test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<EOF\n+commit $head2\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[31mfoo\u001b[32mbar\u001b[34mbaz\u001b[mxyzzy\n EOF\n \n-test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<'EOF'\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<EOF\n+commit $head2\n \u001b[1;31;43mfoo\u001b[m\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n \u001b[1;31;43mfoo\u001b[m\n EOF\n \n@@ -186,39 +197,42 @@ This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: �bueno!\n EOF\n+\n test_expect_success 'setup complex body' '\n-git config i18n.commitencoding iso8859-1 &&\n-  echo change2 >foo && git commit -a -F commit-msg\n+\tgit config i18n.commitencoding iso8859-1 &&\n+\techo change2 >foo && git commit -a -F commit-msg &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n+\thead3_short=$(git rev-parse --short $head3)\n '\n \n-test_format complex-encoding %e <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-encoding %e <<EOF\n+commit $head3\n iso8859-1\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n-test_format complex-subject %s <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-subject %s <<EOF\n+commit $head3\n Test printing of complex bodies\n-commit 131a310eb913d107dd3c09a65d1651175898735d\n+commit $head2\n changed foo\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head1\n added foo\n EOF\n \n-test_format complex-body %b <<'EOF'\n-commit 1ed88da4a5b5ed8c449114ac131efc62178734c3\n+test_format complex-body %b <<EOF\n+commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n include an iso8859 character: �bueno!\n \n-commit 131a310eb913d107dd3c09a65d1651175898735d\n-commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873\n+commit $head2\n+commit $head1\n EOF\n \n test_expect_success '%x00 shows NUL' '\n-\techo  >expect commit 1ed88da4a5b5ed8c449114ac131efc62178734c3 &&\n+\techo  >expect commit $head3 &&\n \techo >>expect fooQbar &&\n \tgit rev-list -1 --format=foo%x00bar HEAD >actual.nul &&\n \tnul_to_q <actual.nul >actual &&\n-- \n1.8.3.1.16.gce2c52e\n"},{"id":"222325","messageId":"569203880cc1c0f5405c5b54efa5ffd8a4907c6b.1372719264.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372719264.git.Alex.Crezoff@gmail.com","subject":"[PATCH v8 2/5] t7102 (reset): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-01T23:19:01Z","receivedAt":"2013-07-01T23:19:01Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t7102-reset.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex df82ec9..05dfb27 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -192,7 +192,8 @@ test_expect_success \\\n \t'changing files and redo the last commit should succeed' '\n \techo \"3rd line 2nd file\" >>secondfile &&\n \tgit commit -a -C ORIG_HEAD &&\n-\tcheck_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&\n+\thead4=$(git rev-parse --verify HEAD) &&\n+\tcheck_changes $head4 &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n \t\t\t$head5\n '\n@@ -211,7 +212,7 @@ test_expect_success \\\n \tgit reset --hard HEAD~2 &&\n \tcheck_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e &&\n \ttest \"$(git rev-parse ORIG_HEAD)\" = \\\n-\t\t\t3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d\n+\t\t\t$head4\n '\n \n >.diff_expect\n@@ -326,10 +327,11 @@ test_expect_success '--hard reset to HEAD should clear a failed merge' '\n \tgit checkout branch2 &&\n \techo \"3rd line in branch2\" >>secondfile &&\n \tgit commit -a -m \"change in branch2\" &&\n+\thead3=$(git rev-parse --verify HEAD) &&\n \n \ttest_must_fail git pull . branch1 &&\n \tgit reset --hard &&\n-\tcheck_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb\n+\tcheck_changes $head3\n '\n \n >.diff_expect\n-- \n1.8.3.1.16.gce2c52e\n"},{"id":"222328","messageId":"aac80dbfcddb20ad3fe1745d6e54da638772ed7c.1372719264.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372719264.git.Alex.Crezoff@gmail.com","subject":"[PATCH v8 3/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-01T23:19:02Z","receivedAt":"2013-07-01T23:19:02Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The expected SHA-1 digests are always available in variables. Use\nthem instead of hardcoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 48 +++++++++++++++++++++++--------------------\n 1 file changed, 26 insertions(+), 22 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 26fbfde..73ba5e8 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -101,7 +101,11 @@ test_expect_failure 'NUL termination with --stat' '\n \n test_expect_success 'setup more commits' '\n \ttest_commit \"message one\" one one message-one &&\n-\ttest_commit \"message two\" two two message-two\n+\ttest_commit \"message two\" two two message-two &&\n+\thead1=$(git rev-parse --verify --short HEAD~0) &&\n+\thead2=$(git rev-parse --verify --short HEAD~1) &&\n+\thead3=$(git rev-parse --verify --short HEAD~2) &&\n+\thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n test_expect_success 'left alignment formatting' '\n@@ -117,18 +121,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %<|(40)%s\" >actual &&\n+test_expect_success 'left alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %<|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1 message two                    Z\n-7cd6c63 message one                    Z\n-1711bf9 add bar                        Z\n-af20c06 initial                        Z\n+$head1 message two                    Z\n+$head2 message one                    Z\n+$head3 add bar                        Z\n+$head4 initial                        Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'left alignment formatting with no padding' '\n \tgit log --pretty=\"format:%<(1)%s\" >actual &&\n@@ -195,18 +199,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'right alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %>|(40)%s\" >actual &&\n+test_expect_success 'right alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %>|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1                      message two\n-7cd6c63                      message one\n-1711bf9                          add bar\n-af20c06                          initial\n+$head1                      message two\n+$head2                      message one\n+$head3                          add bar\n+$head4                          initial\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'right alignment formatting with no padding' '\n \tgit log --pretty=\"format:%>(1)%s\" >actual &&\n@@ -234,18 +238,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'center alignment formatting at the nth column' '\n-\tgit log --pretty=\"format:%h %><|(40)%s\" >actual &&\n+test_expect_success 'center alignment formatting at the nth column' \"\n+\tgit log --pretty='format:%h %><|(40)%s' >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n \tqz_to_tab_space <<\\EOF >expected &&\n-fa33ab1           message two          Z\n-7cd6c63           message one          Z\n-1711bf9             add bar            Z\n-af20c06             initial            Z\n+$head1           message two          Z\n+$head2           message one          Z\n+$head3             add bar            Z\n+$head4             initial            Z\n EOF\n \ttest_cmp expected actual\n-'\n+\"\n \n test_expect_success 'center alignment formatting with no padding' '\n \tgit log --pretty=\"format:%><(1)%s\" >actual &&\n-- \n1.8.3.1.16.gce2c52e\n"},{"id":"222326","messageId":"f0307d1e6d5bebb0a90ff1c0ffe70f8ef32f78df.1372719264.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372719264.git.Alex.Crezoff@gmail.com","subject":"[PATCH v8 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-01T23:19:03Z","receivedAt":"2013-07-01T23:19:03Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"One can set an alias\n\t$ git config alias.lg \"log --graph --pretty=format:'%Cred%h%Creset\n\t-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset'\n\t--abbrev-commit --date=local\"\n\nto see the log as a pretty tree (like *gitk* but in a terminal).\n\nHowever, log messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted even when i18n.logOutputEncoding\nand terminal encoding are the same (e.g. log messages committed on a Cygwin box\nwith Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa).\n\nTo simplify an example we can say the following two commands are expected\nto give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it formats \"%s\".\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nThis patch adds failing tests for the next patch that fixes them.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |  35 ++++++----\n t/t4205-log-pretty-formats.sh    | 146 ++++++++++++++++++++++++---------------\n t/t6006-rev-list-format.sh       |  74 +++++++++++++++-----\n t/t7102-reset.sh                 |  31 ++++++++-\n 4 files changed, 198 insertions(+), 88 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 32d4a60..d300d0c 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -1,6 +1,7 @@\n #!/bin/sh\n #\n # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin\n+# Copyright (c) 2013 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Support for verbose submodule differences in git diff\n@@ -10,6 +11,9 @@ This test tries to verify the sanity of the --submodule option of git diff.\n \n . ./test-lib.sh\n \n+# String \"added\" in German (translated with Google Translate), encoded in UTF-8,\n+# used in sample commit log messages in add_file() function below.\n+added=$(printf \"hinzugef\\303\\274gt\")\n add_file () {\n \t(\n \t\tcd \"$1\" &&\n@@ -19,7 +23,8 @@ add_file () {\n \t\t\techo \"$name\" >\"$name\" &&\n \t\t\tgit add \"$name\" &&\n \t\t\ttest_tick &&\n-\t\t\tgit commit -m \"Add $name\" || exit\n+\t\t\tmsg_added_iso88591=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso8859-1) &&\n+\t\t\tgit -c 'i18n.commitEncoding=iso8859-1' commit -m \"$msg_added_iso88591\"\n \t\tdone >/dev/null &&\n \t\tgit rev-parse --short --verify HEAD\n \t)\n@@ -89,29 +94,29 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward)' '\n+test_expect_failure 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'modified submodule(forward) --submodule' '\n+test_expect_failure 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n-\t  > Add foo3\n+\t  > Add foo3 ($added foo3)\n \tEOF\n \ttest_cmp expected actual\n '\n@@ -138,25 +143,25 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_success 'modified submodule(backward)' '\n+test_expect_failure 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_success 'modified submodule(backward and forward)' '\n+test_expect_failure 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\n-\t  > Add foo5\n-\t  > Add foo4\n-\t  < Add foo3\n-\t  < Add foo2\n+\t  > Add foo5 ($added foo5)\n+\t  > Add foo4 ($added foo4)\n+\t  < Add foo3 ($added foo3)\n+\t  < Add foo2 ($added foo2)\n \tEOF\n \ttest_cmp expected actual\n '\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 73ba5e8..a23da67 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -1,20 +1,44 @@\n #!/bin/sh\n #\n # Copyright (c) 2010, Will Palmer\n+# Copyright (c) 2013, Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n #\n \n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+commit_msg() {\n+\t# String \"initial. initial\" partly in German\n+   # (translated with Google Translate),\n+\t# encoded in UTF-8, used as a commit log message below.\n+\tmsg=$(printf \"initial. anf\\303\\244nglich\")\n+\tif test -n \"$1\"\n+\tthen\n+\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\tfi\n+\tif test -n \"$2\" -a -n \"$3\"\n+\tthen\n+\t\t# cut string, replace cut part with two dots\n+\t\t# $2 - chars count from the beginning of the string\n+\t\t# $3 - \"trailing\" chars\n+\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n+\t\t# as it does with C locale\n+\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n+\tfi\n+\techo $msg\n+}\n+\n test_expect_success 'set up basic repos' '\n \t>foo &&\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit commit -m initial &&\n+\tgit config i18n.commitEncoding iso8859-1 &&\n+\tgit commit -m \"$(commit_msg iso8859-1)\" &&\n \tgit add bar &&\n \ttest_tick &&\n-\tgit commit -m \"add bar\"\n+\tgit commit -m \"add bar\" &&\n+\tgit config --unset i18n.commitEncoding\n '\n \n test_expect_success 'alias builtin format' '\n@@ -38,6 +62,20 @@ test_expect_success 'alias user-defined format' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'alias user-defined tformat with %s (iso8859-1 encoding)' '\n+\tgit config i18n.logOutputEncoding iso8859-1 &&\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\tgit config --unset i18n.logOutputEncoding &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n+test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+\tgit log --oneline >expected-s &&\n+\tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n+\ttest_cmp expected-s actual-s\n+'\n+\n test_expect_success 'alias user-defined tformat' '\n \tgit log --pretty=\"tformat:%h\" >expected &&\n \tgit config pretty.test-alias \"tformat:%h\" &&\n@@ -71,22 +109,22 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_success 'NUL separation' '\n-\tprintf \"add bar\\0initial\" >expected &&\n+test_expect_failure 'NUL separation' '\n+\tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL termination' '\n-\tprintf \"add bar\\0initial\\0\" >expected &&\n+test_expect_failure 'NUL termination' '\n+\tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'NUL separation with --stat' '\n+test_expect_failure 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n \tgit log -z --stat --pretty=\"format:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -94,7 +132,7 @@ test_expect_success 'NUL separation with --stat' '\n test_expect_failure 'NUL termination with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0initial\\n$stat1_part\\n\\0\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n0\" >expected &&\n \tgit log -z --stat --pretty=\"tformat:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -108,172 +146,172 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n-test_expect_success 'left alignment formatting' '\n+test_expect_failure 'left alignment formatting' '\n \tgit log --pretty=\"format:%<(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n message two                            Z\n message one                            Z\n add bar                                Z\n-initial                                Z\n+$(commit_msg)                    Z\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %<|(40)%s' >actual &&\n+test_expect_failure 'left alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %<|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1 message two                    Z\n $head2 message one                    Z\n $head3 add bar                        Z\n-$head4 initial                        Z\n+$head4 $(commit_msg)            Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with no padding' '\n+test_expect_failure 'left alignment formatting with no padding' '\n \tgit log --pretty=\"format:%<(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left alignment formatting with trunc' '\n+test_expect_failure 'left alignment formatting with trunc' '\n \tgit log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n message ..\n message ..\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"8\" \".\\+$\")\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left alignment formatting with ltrunc' '\n+test_expect_failure 'left alignment formatting with ltrunc' '\n \tgit log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n ..sage two\n ..sage one\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"0\" \".\\{11\\}\")\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left alignment formatting with mtrunc' '\n+test_expect_failure 'left alignment formatting with mtrunc' '\n \tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n mess.. two\n mess.. one\n add bar  Z\n-initial  Z\n+$(commit_msg \"\" \"4\" \".\\{11\\}\")\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'right alignment formatting' '\n+test_expect_failure 'right alignment formatting' '\n \tgit log --pretty=\"format:%>(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n Z                            message two\n Z                            message one\n Z                                add bar\n-Z                                initial\n+Z                    $(commit_msg)\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'right alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %>|(40)%s' >actual &&\n+test_expect_failure 'right alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %>|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1                      message two\n $head2                      message one\n $head3                          add bar\n-$head4                          initial\n+$head4              $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'right alignment formatting with no padding' '\n+test_expect_failure 'right alignment formatting with no padding' '\n \tgit log --pretty=\"format:%>(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'center alignment formatting' '\n+test_expect_failure 'center alignment formatting' '\n \tgit log --pretty=\"format:%><(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n Z             message two              Z\n Z             message one              Z\n Z               add bar                Z\n-Z               initial                Z\n+Z         $(commit_msg)          Z\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'center alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %><|(40)%s' >actual &&\n+test_expect_failure 'center alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %><|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1           message two          Z\n $head2           message one          Z\n $head3             add bar            Z\n-$head4             initial            Z\n+$head4       $(commit_msg)      Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'center alignment formatting with no padding' '\n+test_expect_failure 'center alignment formatting with no padding' '\n \tgit log --pretty=\"format:%><(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n-initial\n+$(commit_msg)\n EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'left/right alignment formatting with stealing' '\n+test_expect_failure 'left/right alignment formatting with stealing' '\n \tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n \tgit log --pretty=\"format:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n-initial      A U Thor\n+$(commit_msg \"\" \"8\" \".\\+$\")   A U Thor\n EOF\n \ttest_cmp expected actual\n '\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex cc1008d..e4b50ed 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -1,31 +1,44 @@\n #!/bin/sh\n \n+# Copyright (c) 2009 Jens Lehmann\n+# Copyright (c) 2013 Alexey Shumkin (+ non-UTF-8 commit encoding tests)\n+\n test_description='git rev-list --pretty=format test'\n \n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-terminal.sh\n \n test_tick\n+# String \"added\" in German (translated with Google Translate), encoded in UTF-8,\n+# used as a commit log message below.\n+added=$(printf \"added (hinzugef\\303\\274gt) foo\")\n+added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t iso8859-1)\n+# same but \"changed\"\n+changed=$(printf \"changed (ge\\303\\244ndert) foo\")\n+changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t iso8859-1)\n+\n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n-\tgit commit -m \"added foo\" &&\n+\tgit config i18n.commitEncoding iso8859-1 &&\n+\tgit commit -m \"$added_iso88591\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_short=$(git rev-parse --verify --short $head1) &&\n \ttree1=$(git rev-parse --verify HEAD:) &&\n \ttree1_short=$(git rev-parse --verify --short $tree1) &&\n-\techo changed >foo &&\n-\tgit commit -a -m \"changed foo\" &&\n+\techo \"$changed\" > foo &&\n+\tgit commit -a -m \"$changed_iso88591\" &&\n \thead2=$(git rev-parse --verify HEAD) &&\n \thead2_short=$(git rev-parse --verify --short $head2) &&\n \ttree2=$(git rev-parse --verify HEAD:) &&\n \ttree2_short=$(git rev-parse --verify --short $tree2)\n+\tgit config --unset i18n.commitEncoding\n '\n \n-# usage: test_format name format_string <expected_output\n+# usage: test_format name format_string [failure] <expected_output\n test_format () {\n \tcat >expect.$1\n-\ttest_expect_success \"format $1\" \"\n+\ttest_expect_${3:-success} \"format $1\" \"\n \t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n \t\ttest_cmp expect.$1 output.$1\n \t\"\n@@ -110,14 +123,16 @@ EOF\n \n test_format encoding %e <<EOF\n commit $head2\n+iso8859-1\n commit $head1\n+iso8859-1\n EOF\n \n-test_format subject %s <<EOF\n+test_format subject %s failure <<EOF\n commit $head2\n-changed foo\n+$changed\n commit $head1\n-added foo\n+$added\n EOF\n \n test_format body %b <<EOF\n@@ -125,12 +140,12 @@ commit $head2\n commit $head1\n EOF\n \n-test_format raw-body %B <<EOF\n+test_format raw-body %B failure <<EOF\n commit $head2\n-changed foo\n+$changed\n \n commit $head1\n-added foo\n+$added\n \n EOF\n \n@@ -190,12 +205,12 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '\n \t)\n '\n \n-cat >commit-msg <<'EOF'\n+iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF\n Test printing of complex bodies\n \n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: �bueno!\n+include an iso8859 character: ¡bueno!\n EOF\n \n test_expect_success 'setup complex body' '\n@@ -209,16 +224,18 @@ test_format complex-encoding %e <<EOF\n commit $head3\n iso8859-1\n commit $head2\n+iso8859-1\n commit $head1\n+iso8859-1\n EOF\n \n test_format complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n-changed foo\n+$changed_iso88591\n commit $head1\n-added foo\n+$added_iso88591\n EOF\n \n test_format complex-body %b <<EOF\n@@ -231,6 +248,29 @@ commit $head2\n commit $head1\n EOF\n \n+# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set\n+# so unset i18n.commitEncoding to test encoding conversion\n+git config --unset i18n.commitEncoding\n+\n+test_format complex-subject-commitencoding-unset %s failure <<EOF\n+commit $head3\n+Test printing of complex bodies\n+commit $head2\n+$changed\n+commit $head1\n+$added\n+EOF\n+\n+test_format complex-body-commitencoding-unset %b failure <<EOF\n+commit $head3\n+This commit message is much longer than the others,\n+and it will be encoded in iso8859-1. We should therefore\n+include an iso8859 character: ¡bueno!\n+\n+commit $head2\n+commit $head1\n+EOF\n+\n test_expect_success '%x00 shows NUL' '\n \techo  >expect commit $head3 &&\n \techo >>expect fooQbar &&\n@@ -279,12 +319,12 @@ test_expect_success 'add LF before non-empty (2)' '\n \n test_expect_success 'add SP before non-empty (1)' '\n \tgit show -s --pretty=format:\"%s% bThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 2\n+\ttest $(wc -w <actual) = 3\n '\n \n test_expect_success 'add SP before non-empty (2)' '\n \tgit show -s --pretty=format:\"%s% sThanks\" HEAD^^ >actual &&\n-\ttest $(wc -w <actual) = 4\n+\ttest $(wc -w <actual) = 6\n '\n \n test_expect_success '--abbrev' '\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 05dfb27..6a92703 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -9,6 +9,19 @@ Documented tests for git reset'\n \n . ./test-lib.sh\n \n+commit_msg() {\n+\t# String \"modify 2nd file (changed)\" partly in German\n+\t# (translated with Google Translate),\n+\t# encoded in UTF-8, used as a commit log message below.\n+\tprintf \"modify 2nd file (ge\\303\\244ndert)\" |\n+\tif test -n \"$1\"\n+\tthen\n+\t\ticonv -f utf-8 -t $1\n+\telse\n+\t\tcat\n+\tfi\n+}\n+\n test_expect_success 'creating initial files and commits' '\n \ttest_tick &&\n \techo \"1st file\" >first &&\n@@ -28,7 +41,7 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -44,6 +57,20 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n+test_expect_failure 'reset --hard message' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg) > .expected &&\n+\ttest_cmp .expected .actual\n+'\n+\n+test_expect_success 'reset --hard message (iso8859-1 logoutputencoding)' '\n+\thex=$(git log -1 --format=\"%h\") &&\n+\tgit -c \"i18n.logOutputEncoding=iso8859-1\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg iso8859-1) > .expected &&\n+\ttest_cmp .expected .actual\n+'\n+\n >.diff_expect\n >.cached_expect\n cat >.cat_expect <<EOF\n@@ -304,7 +331,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit commit -a -m \"modify 2nd file\" &&\n+\tgit -c \"i18n.commitEncoding=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n \tcheck_changes $head5\n '\n \n-- \n1.8.3.1.16.gce2c52e\n"},{"id":"222327","messageId":"fb6c79d8beef8bf0debc82591b52265ca2a3bb0a.1372719264.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372719264.git.Alex.Crezoff@gmail.com","subject":"[PATCH v8 5/5] pretty: --format output should honor logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-01T23:19:04Z","receivedAt":"2013-07-01T23:19:04Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"One can set an alias\n\t$ git config [--global] alias.lg \"log --graph --pretty=format:'%Cred%h%Creset\n\t-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset'\n\t--abbrev-commit --date=local\"\n\nto see the log as a pretty tree (like *gitk* but in a terminal).\n\nHowever, log messages written in an encoding i18n.commitEncoding which differs\nfrom terminal encoding are shown corrupted even when i18n.logOutputEncoding\nand terminal encoding are the same (e.g. log messages committed on a Cygwin box\nwith Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa).\n\nTo simplify an example we can say the following two commands are expected\nto give the same output to a terminal:\n\n\t$ git log --oneline --no-color\n\t$ git log --pretty=format:'%h %s'\n\nHowever, the former pays attention to i18n.logOutputEncoding\nconfiguration, while the latter does not when it formats \"%s\".\n\nThe same corruption is true for\n\t$ git diff --submodule=log\nand\n\t$ git rev-list --pretty=format:%s HEAD\nand\n\t$ git reset --hard\n\nThis patch makes pretty --format honor logOutputEncoding when it formats\nlog message.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n builtin/reset.c                  |  5 ++++-\n builtin/rev-list.c               |  1 +\n builtin/shortlog.c               |  1 +\n log-tree.c                       |  1 +\n submodule.c                      |  1 +\n t/t4041-diff-submodule-option.sh | 10 +++++-----\n t/t4205-log-pretty-formats.sh    | 34 +++++++++++++++++-----------------\n t/t6006-rev-list-format.sh       |  8 ++++----\n t/t7102-reset.sh                 |  2 +-\n 9 files changed, 35 insertions(+), 28 deletions(-)\n\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 6032131..afa6e02 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -93,10 +93,12 @@ static int reset_index(const unsigned char *sha1, int reset_type, int quiet)\n static void print_new_head_line(struct commit *commit)\n {\n \tconst char *hex, *body;\n+\tchar *msg;\n \n \thex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);\n \tprintf(_(\"HEAD is now at %s\"), hex);\n-\tbody = strstr(commit->buffer, \"\\n\\n\");\n+\tmsg = logmsg_reencode(commit, NULL, get_log_output_encoding());\n+\tbody = strstr(msg, \"\\n\\n\");\n \tif (body) {\n \t\tconst char *eol;\n \t\tsize_t len;\n@@ -107,6 +109,7 @@ static void print_new_head_line(struct commit *commit)\n \t}\n \telse\n \t\tprintf(\"\\n\");\n+\tlogmsg_free(msg, commit);\n }\n \n static void update_index_from_diff(struct diff_queue_struct *q,\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 67701be..a5ec30d 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -111,6 +111,7 @@ static void show_commit(struct commit *commit, void *data)\n \t\tctx.date_mode = revs->date_mode;\n \t\tctx.date_mode_explicit = revs->date_mode_explicit;\n \t\tctx.fmt = revs->commit_format;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &buf);\n \t\tif (revs->graph) {\n \t\t\tif (buf.len) {\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 1fd6f8a..1434f8f 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -137,6 +137,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n \t\tctx.date_mode = DATE_NORMAL;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tpretty_print_commit(&ctx, commit, &ufbuf);\n \t\tbuffer = ufbuf.buf;\n \t} else if (*buffer) {\ndiff --git a/log-tree.c b/log-tree.c\nindex 1946e9c..5277d3e 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -616,6 +616,7 @@ void show_log(struct rev_info *opt)\n \tctx.fmt = opt->commit_format;\n \tctx.mailmap = opt->mailmap;\n \tctx.color = opt->diffopt.use_color;\n+\tctx.output_encoding = get_log_output_encoding();\n \tpretty_print_commit(&ctx, commit, &msgbuf);\n \n \tif (opt->add_signoff)\ndiff --git a/submodule.c b/submodule.c\nindex 1821a5b..78734e1 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -226,6 +226,7 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,\n \twhile ((commit = get_revision(rev))) {\n \t\tstruct pretty_print_context ctx = {0};\n \t\tctx.date_mode = rev->date_mode;\n+\t\tctx.output_encoding = get_log_output_encoding();\n \t\tstrbuf_setlen(&sb, 0);\n \t\tstrbuf_addstr(&sb, line_prefix);\n \t\tif (commit->object.flags & SYMMETRIC_LEFT) {\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex d300d0c..04348ea 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -94,7 +94,7 @@ test_expect_success 'diff.submodule does not affect plumbing' '\n commit_file sm1 &&\n head2=$(add_file sm1 foo3)\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -103,7 +103,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward)' '\n+test_expect_success 'modified submodule(forward)' '\n \tgit diff --submodule=log >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -112,7 +112,7 @@ test_expect_failure 'modified submodule(forward)' '\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'modified submodule(forward) --submodule' '\n+test_expect_success 'modified submodule(forward) --submodule' '\n \tgit diff --submodule >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head1..$head2:\n@@ -143,7 +143,7 @@ head3=$(\n \tgit rev-parse --short --verify HEAD\n )\n \n-test_expect_failure 'modified submodule(backward)' '\n+test_expect_success 'modified submodule(backward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2..$head3 (rewind):\n@@ -154,7 +154,7 @@ test_expect_failure 'modified submodule(backward)' '\n '\n \n head4=$(add_file sm1 foo4 foo5)\n-test_expect_failure 'modified submodule(backward and forward)' '\n+test_expect_success 'modified submodule(backward and forward)' '\n \tgit diff-index -p --submodule=log HEAD >actual &&\n \tcat >expected <<-EOF &&\n \tSubmodule sm1 $head2...$head4:\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex a23da67..5e13000 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -70,7 +70,7 @@ test_expect_success 'alias user-defined tformat with %s (iso8859-1 encoding)' '\n \ttest_cmp expected-s actual-s\n '\n \n-test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '\n+test_expect_success 'alias user-defined tformat with %s (utf-8 encoding)' '\n \tgit log --oneline >expected-s &&\n \tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n \ttest_cmp expected-s actual-s\n@@ -109,19 +109,19 @@ test_expect_success 'alias loop' '\n \ttest_must_fail git log --pretty=test-foo\n '\n \n-test_expect_failure 'NUL separation' '\n+test_expect_success 'NUL separation' '\n \tprintf \"add bar\\0$(commit_msg)\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL termination' '\n+test_expect_success 'NUL termination' '\n \tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'NUL separation with --stat' '\n+test_expect_success 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n \tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n@@ -146,7 +146,7 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n-test_expect_failure 'left alignment formatting' '\n+test_expect_success 'left alignment formatting' '\n \tgit log --pretty=\"format:%<(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -159,7 +159,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting at the nth column' '\n+test_expect_success 'left alignment formatting at the nth column' '\n \tgit log --pretty=\"format:%h %<|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -172,7 +172,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with no padding' '\n+test_expect_success 'left alignment formatting with no padding' '\n \tgit log --pretty=\"format:%<(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -185,7 +185,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with trunc' '\n+test_expect_success 'left alignment formatting with trunc' '\n \tgit log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -198,7 +198,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with ltrunc' '\n+test_expect_success 'left alignment formatting with ltrunc' '\n \tgit log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -211,7 +211,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with mtrunc' '\n+test_expect_success 'left alignment formatting with mtrunc' '\n \tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -224,7 +224,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'right alignment formatting' '\n+test_expect_success 'right alignment formatting' '\n \tgit log --pretty=\"format:%>(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -237,7 +237,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'right alignment formatting at the nth column' '\n+test_expect_success 'right alignment formatting at the nth column' '\n \tgit log --pretty=\"format:%h %>|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -250,7 +250,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'right alignment formatting with no padding' '\n+test_expect_success 'right alignment formatting with no padding' '\n \tgit log --pretty=\"format:%>(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -263,7 +263,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'center alignment formatting' '\n+test_expect_success 'center alignment formatting' '\n \tgit log --pretty=\"format:%><(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -276,7 +276,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'center alignment formatting at the nth column' '\n+test_expect_success 'center alignment formatting at the nth column' '\n \tgit log --pretty=\"format:%h %><|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -289,7 +289,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'center alignment formatting with no padding' '\n+test_expect_success 'center alignment formatting with no padding' '\n \tgit log --pretty=\"format:%><(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -302,7 +302,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left/right alignment formatting with stealing' '\n+test_expect_success 'left/right alignment formatting with stealing' '\n \tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n \tgit log --pretty=\"format:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \t# complete the incomplete line at the end\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex e4b50ed..18d7909 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -128,7 +128,7 @@ commit $head1\n iso8859-1\n EOF\n \n-test_format subject %s failure <<EOF\n+test_format subject %s <<EOF\n commit $head2\n $changed\n commit $head1\n@@ -140,7 +140,7 @@ commit $head2\n commit $head1\n EOF\n \n-test_format raw-body %B failure <<EOF\n+test_format raw-body %B <<EOF\n commit $head2\n $changed\n \n@@ -252,7 +252,7 @@ EOF\n # so unset i18n.commitEncoding to test encoding conversion\n git config --unset i18n.commitEncoding\n \n-test_format complex-subject-commitencoding-unset %s failure <<EOF\n+test_format complex-subject-commitencoding-unset %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n@@ -261,7 +261,7 @@ commit $head1\n $added\n EOF\n \n-test_format complex-body-commitencoding-unset %b failure <<EOF\n+test_format complex-body-commitencoding-unset %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 6a92703..73a1bdb 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -57,7 +57,7 @@ check_changes () {\n \tdone | test_cmp .cat_expect -\n }\n \n-test_expect_failure 'reset --hard message' '\n+test_expect_success 'reset --hard message' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg) > .expected &&\n-- \n1.8.3.1.16.gce2c52e\n"},{"id":"222344","messageId":"51D2773B.9020006@viscovery.net","threadId":"28440","inReplyTo":"f0307d1e6d5bebb0a90ff1c0ffe70f8ef32f78df.1372719264.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v8 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-07-02T06:46:19Z","receivedAt":"2013-07-02T06:46:19Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 7/2/2013 1:19, schrieb Alexey Shumkin:\n> +commit_msg() {\n> +\t# String \"initial. initial\" partly in German\n> +   # (translated with Google Translate),\n> +\t# encoded in UTF-8, used as a commit log message below.\n> +\tmsg=$(printf \"initial. anf\\303\\244nglich\")\n> +\tif test -n \"$1\"\n> +\tthen\n> +\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n> +\tfi\n> +\tif test -n \"$2\" -a -n \"$3\"\n> +\tthen\n> +\t\t# cut string, replace cut part with two dots\n> +\t\t# $2 - chars count from the beginning of the string\n> +\t\t# $3 - \"trailing\" chars\n> +\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n> +\t\t# as it does with C locale\n> +\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n> +\tfi\n> +\techo $msg\n> +}\n\nIgnoring failure reports is not very helpful. Anyway, here is how I would\nadjust this patch. (There are trivial conflicts when 5/5 is applied on\ntop.) Notice the comment I added in test case 'left alignment formatting\nwith ltrunc'.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n\nTo be squashed into v8 4/5:\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex a23da67..ef3a226 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -7,25 +7,13 @@\n test_description='Test pretty formats'\n . ./test-lib.sh\n \n-commit_msg() {\n-\t# String \"initial. initial\" partly in German\n-   # (translated with Google Translate),\n-\t# encoded in UTF-8, used as a commit log message below.\n-\tmsg=$(printf \"initial. anf\\303\\244nglich\")\n-\tif test -n \"$1\"\n-\tthen\n-\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n-\tfi\n-\tif test -n \"$2\" -a -n \"$3\"\n-\tthen\n-\t\t# cut string, replace cut part with two dots\n-\t\t# $2 - chars count from the beginning of the string\n-\t\t# $3 - \"trailing\" chars\n-\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n-\t\t# as it does with C locale\n-\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n-\tfi\n-\techo $msg\n+# String \"initial. initial\" partly in German encoded in UTF-8\n+initial_msg=$(printf \"initial. anf\\303\\244nglich\")\n+\n+# extract part of the initial commit message\n+# $1 - a RE with \\( \\) brackets that specify which part to keep\n+extract_msg() {\n+\techo \"$initial_msg\" | sed -e \"s/$1/\\1/\"\n }\n \n test_expect_success 'set up basic repos' '\n@@ -33,12 +21,11 @@ test_expect_success 'set up basic repos' '\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit config i18n.commitEncoding iso8859-1 &&\n-\tgit commit -m \"$(commit_msg iso8859-1)\" &&\n+\ttest_config i18n.commitEncoding iso8859-1 &&\n+\tgit commit -m \"$(echo \"$initial_msg\" | iconv -f utf-8 -t iso8859-1)\" &&\n \tgit add bar &&\n \ttest_tick &&\n-\tgit commit -m \"add bar\" &&\n-\tgit config --unset i18n.commitEncoding\n+\tgit commit -m \"add bar\"\n '\n \n test_expect_success 'alias builtin format' '\n@@ -63,10 +50,9 @@ test_expect_success 'alias user-defined format' '\n '\n \n test_expect_success 'alias user-defined tformat with %s (iso8859-1 encoding)' '\n-\tgit config i18n.logOutputEncoding iso8859-1 &&\n+\ttest_config i18n.logOutputEncoding iso8859-1 &&\n \tgit log --oneline >expected-s &&\n \tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n-\tgit config --unset i18n.logOutputEncoding &&\n \ttest_cmp expected-s actual-s\n '\n \n@@ -110,13 +96,13 @@ test_expect_success 'alias loop' '\n '\n \n test_expect_failure 'NUL separation' '\n-\tprintf \"add bar\\0$(commit_msg)\" >expected &&\n+\tprintf \"add bar\\0$initial_msg\" >expected &&\n \tgit log -z --pretty=\"format:%s\" >actual &&\n \ttest_cmp expected actual\n '\n \n test_expect_failure 'NUL termination' '\n-\tprintf \"add bar\\0$(commit_msg)\\0\" >expected &&\n+\tprintf \"add bar\\0$initial_msg\\0\" >expected &&\n \tgit log -z --pretty=\"tformat:%s\" >actual &&\n \ttest_cmp expected actual\n '\n@@ -124,7 +110,7 @@ test_expect_failure 'NUL termination' '\n test_expect_failure 'NUL separation with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$initial_msg\\n$stat1_part\\n\" >expected &&\n \tgit log -z --stat --pretty=\"format:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -132,7 +118,7 @@ test_expect_failure 'NUL separation with --stat' '\n test_expect_failure 'NUL termination with --stat' '\n \tstat0_part=$(git diff --stat HEAD^ HEAD) &&\n \tstat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&\n-\tprintf \"add bar\\n$stat0_part\\n\\0$(commit_msg)\\n$stat1_part\\n0\" >expected &&\n+\tprintf \"add bar\\n$stat0_part\\n\\0$initial_msg\\n$stat1_part\\n0\" >expected &&\n \tgit log -z --stat --pretty=\"tformat:%s\" >actual &&\n \ttest_i18ncmp expected actual\n '\n@@ -154,7 +140,7 @@ test_expect_failure 'left alignment formatting' '\n message two                            Z\n message one                            Z\n add bar                                Z\n-$(commit_msg)                    Z\n+$initial_msg                    Z\n EOF\n \ttest_cmp expected actual\n '\n@@ -167,7 +153,7 @@ test_expect_failure 'left alignment formatting at the nth column' '\n $head1 message two                    Z\n $head2 message one                    Z\n $head3 add bar                        Z\n-$head4 $(commit_msg)            Z\n+$head4 $initial_msg            Z\n EOF\n \ttest_cmp expected actual\n '\n@@ -180,7 +166,7 @@ test_expect_failure 'left alignment formatting with no padding' '\n message two\n message one\n add bar\n-$(commit_msg)\n+$initial_msg\n EOF\n \ttest_cmp expected actual\n '\n@@ -193,7 +179,7 @@ test_expect_failure 'left alignment formatting with trunc' '\n message ..\n message ..\n add bar  Z\n-$(commit_msg \"\" \"8\" \".\\+$\")\n+$(extract_msg \"^\\(........\\).*\")..\n EOF\n \ttest_cmp expected actual\n '\n@@ -206,8 +192,10 @@ test_expect_failure 'left alignment formatting with ltrunc' '\n ..sage two\n ..sage one\n add bar  Z\n-$(commit_msg \"\" \"0\" \".\\{11\\}\")\n+..$(extract_msg \".*\\(.........\\)$\")\n EOF\n+\t# the RE above covers 9 bytes because there is one UTF-8 character\n+\t# where two bytes occupy only one character position\n \ttest_cmp expected actual\n '\n \n@@ -219,7 +207,7 @@ test_expect_failure 'left alignment formatting with mtrunc' '\n mess.. two\n mess.. one\n add bar  Z\n-$(commit_msg \"\" \"4\" \".\\{11\\}\")\n+$(extract_msg \"^\\(....\\).*\")..$(extract_msg \".*\\(....\\)$\")\n EOF\n \ttest_cmp expected actual\n '\n@@ -232,7 +220,7 @@ test_expect_failure 'right alignment formatting' '\n Z                            message two\n Z                            message one\n Z                                add bar\n-Z                    $(commit_msg)\n+Z                    $initial_msg\n EOF\n \ttest_cmp expected actual\n '\n@@ -245,7 +233,7 @@ test_expect_failure 'right alignment formatting at the nth column' '\n $head1                      message two\n $head2                      message one\n $head3                          add bar\n-$head4              $(commit_msg)\n+$head4              $initial_msg\n EOF\n \ttest_cmp expected actual\n '\n@@ -258,7 +246,7 @@ test_expect_failure 'right alignment formatting with no padding' '\n message two\n message one\n add bar\n-$(commit_msg)\n+$initial_msg\n EOF\n \ttest_cmp expected actual\n '\n@@ -271,7 +259,7 @@ test_expect_failure 'center alignment formatting' '\n Z             message two              Z\n Z             message one              Z\n Z               add bar                Z\n-Z         $(commit_msg)          Z\n+Z         $initial_msg          Z\n EOF\n \ttest_cmp expected actual\n '\n@@ -284,7 +272,7 @@ test_expect_failure 'center alignment formatting at the nth column' '\n $head1           message two          Z\n $head2           message one          Z\n $head3             add bar            Z\n-$head4       $(commit_msg)      Z\n+$head4       $initial_msg      Z\n EOF\n \ttest_cmp expected actual\n '\n@@ -297,7 +285,7 @@ test_expect_failure 'center alignment formatting with no padding' '\n message two\n message one\n add bar\n-$(commit_msg)\n+$initial_msg\n EOF\n \ttest_cmp expected actual\n '\n@@ -311,7 +299,7 @@ test_expect_failure 'left/right alignment formatting with stealing' '\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n-$(commit_msg \"\" \"8\" \".\\+$\")   A U Thor\n+$(extract_msg \"^\\(........\\).*\")..   A U Thor\n EOF\n \ttest_cmp expected actual\n '\n"},{"id":"222345","messageId":"51D27FA1.9040600@viscovery.net","threadId":"28440","inReplyTo":"20130701225013.GA17377@ashu.dyn1.rarus.ru","subject":"Re: [PATCH v7 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-07-02T07:22:09Z","receivedAt":"2013-07-02T07:22:09Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 7/2/2013 0:50, schrieb Alexey Shumkin:\n> On Mon, Jul 01, 2013 at 09:00:55AM +0200, Johannes Sixt wrote:\n>> Am 6/26/2013 12:19, schrieb Alexey Shumkin:\n>>>  test_expect_success 'setup complex body' '\n>>>  \tgit config i18n.commitencoding iso8859-1 &&\n>>>  \techo change2 >foo && git commit -a -F commit-msg &&\n>>>  \thead3=$(git rev-parse --verify HEAD) &&\n>>> -\thead3_short=$(git rev-parse --short $head3)\n>>> +\thead3_short=$(git rev-parse --short $head3) &&\n>>> +\t# unset commit encoding config\n>>> +\t# otherwise %e does not print encoding value\n>>> +\t# and following test fails\n>>\n>> I don't understand this comment. The test vector below already shows that\n>> an encoding is printed. Why would this suddenly be different with the\n>> updated tests?\n> I've changed tests. I've reverted back these ones, and added\n> new ones with no i18n.commitEncoding set\n>>\n>> Assuming that this change doesn't sweep a deeper problem under the rug,\n>> it's better to use test_config a few lines earlier.\n>>\n>>> +\tgit config --unset i18n.commitEncoding\n>>> +\n>>>  '\n>>>  \n>>>  test_format complex-encoding %e <<EOF\n>>>  commit $head3\n>>>  iso8859-1\n>>\n>> This is the encoding that I mean.\n> These encodings \"have appeared\" because we've changed 'setup':\n> we make commits with i18n.commitEncoding set\n\nI understand why there are additional encoding entries in the expected\noutput, but we see one encoding entry already listed without this patch.\nWhy do you say \"does not print encoding value\" in the comment above?\n\n>>\n>>>  commit $head2\n>>> +iso-8859-1\n>>>  commit $head1\n>>> +iso-8859-1\n>>>  EOF\n\n-- Hannes\n"},{"id":"222394","messageId":"7vbo6klpgw.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"cover.1372719264.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v8 0/5] Reroll patches against Git v1.8.3.2","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-02T19:41:03Z","receivedAt":"2013-07-02T19:41:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n\n> v8 of this patch series includes the following changes against v7:\n\nOops, isn't this already in 'next'?  In that case, please feed\nincremental updates on top of the patches that are already queued as\nimprovements and fixes.\n\nThanks.\n"},{"id":"222490","messageId":"20130703200304.GA32573@dell-note","threadId":"28440","inReplyTo":"7vbo6klpgw.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v8 0/5] Reroll patches against Git v1.8.3.2","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-03T20:03:04Z","receivedAt":"2013-07-03T20:03:04Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Tue, Jul 02, 2013 at 12:41:03PM -0700, Junio C Hamano wrote:\n> Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n> \n> > v8 of this patch series includes the following changes against v7:\n> \n> Oops, isn't this already in 'next'?  In that case, please feed\n> incremental updates on top of the patches that are already queued as\n> improvements and fixes.\nOops ;)\nI'll send patches against 'next' then.\n> \n> Thanks.\n"},{"id":"222492","messageId":"7vip0re7c1.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"20130703200304.GA32573@dell-note","subject":"Re: [PATCH v8 0/5] Reroll patches against Git v1.8.3.2","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-03T20:06:54Z","receivedAt":"2013-07-03T20:06:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> On Tue, Jul 02, 2013 at 12:41:03PM -0700, Junio C Hamano wrote:\n>> Alexey Shumkin <Alex.Crezoff@gmail.com> writes:\n>> \n>> > v8 of this patch series includes the following changes against v7:\n>> \n>> Oops, isn't this already in 'next'?  In that case, please feed\n>> incremental updates on top of the patches that are already queued as\n>> improvements and fixes.\n> Oops ;)\n> I'll send patches against 'next' then.\n\nThanks; please build on top of 7c375214 (t4205: replace .\\+ with ..*\nin sed commands, 2013-07-01).\n"},{"id":"222495","messageId":"20130703202015.GB32573@dell-note","threadId":"28440","inReplyTo":"51D27FA1.9040600@viscovery.net","subject":"Re: [PATCH v7 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-03T20:20:15Z","receivedAt":"2013-07-03T20:20:15Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Tue, Jul 02, 2013 at 09:22:09AM +0200, Johannes Sixt wrote:\n> Am 7/2/2013 0:50, schrieb Alexey Shumkin:\n> > On Mon, Jul 01, 2013 at 09:00:55AM +0200, Johannes Sixt wrote:\n> >> Am 6/26/2013 12:19, schrieb Alexey Shumkin:\n> >>>  test_expect_success 'setup complex body' '\n> >>>  \tgit config i18n.commitencoding iso8859-1 &&\n> >>>  \techo change2 >foo && git commit -a -F commit-msg &&\n> >>>  \thead3=$(git rev-parse --verify HEAD) &&\n> >>> -\thead3_short=$(git rev-parse --short $head3)\n> >>> +\thead3_short=$(git rev-parse --short $head3) &&\n> >>> +\t# unset commit encoding config\n> >>> +\t# otherwise %e does not print encoding value\n> >>> +\t# and following test fails\n> >>\n> >> I don't understand this comment. The test vector below already shows that\n> >> an encoding is printed. Why would this suddenly be different with the\n> >> updated tests?\n> > I've changed tests. I've reverted back these ones, and added\n> > new ones with no i18n.commitEncoding set\n> >>\n> >> Assuming that this change doesn't sweep a deeper problem under the rug,\n> >> it's better to use test_config a few lines earlier.\n> >>\n> >>> +\tgit config --unset i18n.commitEncoding\n> >>> +\n> >>>  '\n> >>>  \n> >>>  test_format complex-encoding %e <<EOF\n> >>>  commit $head3\n> >>>  iso8859-1\n> >>\n> >> This is the encoding that I mean.\n> > These encodings \"have appeared\" because we've changed 'setup':\n> > we make commits with i18n.commitEncoding set\n> \n> I understand why there are additional encoding entries in the expected\n> output, but we see one encoding entry already listed without this patch.\n> Why do you say \"does not print encoding value\" in the comment above?\nI don't even remember today. I guess (that comment initially was written\nloooooong time time ago), that was a \"legacy\" comment.\nNevermind,\nnowadays it's removed ;)\n> \n> >>\n> >>>  commit $head2\n> >>> +iso-8859-1\n> >>>  commit $head1\n> >>> +iso-8859-1\n> >>>  EOF\n> \n> -- Hannes\n"},{"id":"222547","messageId":"cover.1372939482.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372719264.git.Alex.Crezoff@gmail.com","subject":"[PATCH v9 0/5] Incremental updates against 'next' branch","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-04T12:45:45Z","receivedAt":"2013-07-04T12:45:45Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"This patch series is an incremental updates on top of (7c375214 t4205:\nreplace .\\+ with ..* in sed commands, 2013-07-01) as far as v7 patches\nwere applied to the 'next' branch but there were more improvements made\nin v8.\n\nAlexey Shumkin (5):\n  t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1\n  t4205: revert back single quotes\n  t4205, t6006, t7102: make functions more readable\n  t6006: add two more tests for the case i18n.commitEncoding is not set\n  t4205: avoid using `sed`\n\n t/t4041-diff-submodule-option.sh |   4 +-\n t/t4205-log-pretty-formats.sh    | 145 +++++++++++++++++++--------------------\n t/t6006-rev-list-format.sh       |  69 ++++++++++---------\n t/t7102-reset.sh                 |  22 +++---\n 4 files changed, 121 insertions(+), 119 deletions(-)\n\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222548","messageId":"38cdab6c314e858ec580b1d0fbf87098c2d92cb0.1372939482.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372939482.git.Alex.Crezoff@gmail.com","subject":"[PATCH v9 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-04T12:45:46Z","receivedAt":"2013-07-04T12:45:46Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"This is actually a fixup of de6029a2d7734a93a9e27b9c4471862a47dd8123,\nwhich was applied before final patch series was sent.\n\nAlso, see 3994e8a98dc7bbf67e61d23c8125f44383499a1f for the explanation\nof such a replacement.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nReviewed-by: Johannes Sixt <j.sixt@viscovery.net>\n---\n t/t4041-diff-submodule-option.sh |  4 ++--\n t/t4205-log-pretty-formats.sh    |  8 ++++----\n t/t6006-rev-list-format.sh       | 14 +++++++-------\n t/t7102-reset.sh                 | 10 +++++-----\n 4 files changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 0a4f496..1751c83 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -23,8 +23,8 @@ add_file () {\n \t\t\techo \"$name\" >\"$name\" &&\n \t\t\tgit add \"$name\" &&\n \t\t\ttest_tick &&\n-\t\t\tmsg_added_iso88591=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso-8859-1) &&\n-\t\t\tgit -c 'i18n.commitEncoding=iso-8859-1' commit -m \"$msg_added_iso88591\"\n+\t\t\tmsg_added_iso88591=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso8859-1) &&\n+\t\t\tgit -c 'i18n.commitEncoding=iso8859-1' commit -m \"$msg_added_iso88591\"\n \t\tdone >/dev/null &&\n \t\tgit rev-parse --short --verify HEAD\n \t)\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 3cfb744..c283842 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -32,8 +32,8 @@ test_expect_success 'set up basic repos' '\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit config i18n.commitEncoding iso-8859-1 &&\n-\tgit commit -m \"$(commit_msg iso-8859-1)\" &&\n+\tgit config i18n.commitEncoding iso8859-1 &&\n+\tgit commit -m \"$(commit_msg iso8859-1)\" &&\n \tgit add bar &&\n \ttest_tick &&\n \tgit commit -m \"add bar\" &&\n@@ -61,8 +61,8 @@ test_expect_success 'alias user-defined format' '\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'alias user-defined tformat with %s (iso-8859-1 encoding)' '\n-\tgit config i18n.logOutputEncoding iso-8859-1 &&\n+test_expect_success 'alias user-defined tformat with %s (iso8859-1 encoding)' '\n+\tgit config i18n.logOutputEncoding iso8859-1 &&\n \tgit log --oneline >expected-s &&\n \tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n \tgit config --unset i18n.logOutputEncoding &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 380c85b..4751d22 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -12,15 +12,15 @@ test_tick\n # String \"added\" in German (translated with Google Translate), encoded in UTF-8,\n # used as a commit log message below.\n added=$(printf \"added (hinzugef\\303\\274gt) foo\")\n-added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t iso-8859-1)\n+added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t iso8859-1)\n # same but \"changed\"\n changed=$(printf \"changed (ge\\303\\244ndert) foo\")\n-changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t iso-8859-1)\n+changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t iso8859-1)\n \n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n-\tgit config i18n.commitEncoding iso-8859-1 &&\n+\tgit config i18n.commitEncoding iso8859-1 &&\n \tgit commit -m \"$added_iso88591\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_short=$(git rev-parse --verify --short $head1) &&\n@@ -136,9 +136,9 @@ EOF\n \n test_format encoding %e <<EOF\n commit $head2\n-iso-8859-1\n+iso8859-1\n commit $head1\n-iso-8859-1\n+iso8859-1\n EOF\n \n test_format subject %s <<EOF\n@@ -242,9 +242,9 @@ test_format complex-encoding %e <<EOF\n commit $head3\n iso8859-1\n commit $head2\n-iso-8859-1\n+iso8859-1\n commit $head1\n-iso-8859-1\n+iso8859-1\n EOF\n \n test_format complex-subject %s <<EOF\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 9132dd9..2ef96e9 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -39,7 +39,7 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit -c \"i18n.commitEncoding=iso-8859-1\" commit -a -m \"$(commit_msg iso-8859-1)\" &&\n+\tgit -c \"i18n.commitEncoding=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -62,10 +62,10 @@ test_expect_success 'reset --hard message' '\n \ttest_cmp .expected .actual\n '\n \n-test_expect_success 'reset --hard message (iso-8859-1 logoutencoding)' '\n+test_expect_success 'reset --hard message (iso8859-1 logoutputencoding)' '\n \thex=$(git log -1 --format=\"%h\") &&\n-\tgit -c \"i18n.logOutputEncoding=iso-8859-1\" reset --hard > .actual &&\n-\techo HEAD is now at $hex $(commit_msg iso-8859-1) > .expected &&\n+\tgit -c \"i18n.logOutputEncoding=iso8859-1\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg iso8859-1) > .expected &&\n \ttest_cmp .expected .actual\n '\n \n@@ -329,7 +329,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit -c \"i18n.commitEncoding=iso-8859-1\" commit -a -m \"$(commit_msg iso-8859-1)\" &&\n+\tgit -c \"i18n.commitEncoding=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n \tcheck_changes $head5\n '\n \n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222549","messageId":"b7ac1f5c14ab4571f06030ab02a33b1489ab4dcd.1372939482.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372939482.git.Alex.Crezoff@gmail.com","subject":"[PATCH v9 2/5] t4205: revert back single quotes","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-04T12:45:47Z","receivedAt":"2013-07-04T12:45:47Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"In previuos commit de6029a2d7734a93a9e27b9c4471862a47dd8123 single\nquotes were replaced with double quotes to make \"$(commit_msg)\"\nexpression in heredoc to work. The same effect can be achieved by using\n\"EOF\" as a heredoc delimiter instead of \"\\EOF\".\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nSuggested-by: Johannes Sixt <j.sixt@viscovery.net>\n---\n t/t4205-log-pretty-formats.sh | 106 +++++++++++++++++++++---------------------\n 1 file changed, 53 insertions(+), 53 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex c283842..ef9770a 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -145,174 +145,174 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n-test_expect_success 'left alignment formatting' \"\n-\tgit log --pretty='format:%<(40)%s' >actual &&\n+test_expect_success 'left alignment formatting' '\n+\tgit log --pretty=\"format:%<(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n message two                            Z\n message one                            Z\n add bar                                Z\n $(commit_msg)                    Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %<|(40)%s' >actual &&\n+test_expect_success 'left alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %<|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1 message two                    Z\n $head2 message one                    Z\n $head3 add bar                        Z\n $head4 $(commit_msg)            Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with no padding' \"\n-\tgit log --pretty='format:%<(1)%s' >actual &&\n+test_expect_success 'left alignment formatting with no padding' '\n+\tgit log --pretty=\"format:%<(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with trunc' \"\n-\tgit log --pretty='format:%<(10,trunc)%s' >actual &&\n+test_expect_success 'left alignment formatting with trunc' '\n+\tgit log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n message ..\n message ..\n add bar  Z\n $(commit_msg \"\" \"8\" \"..*$\")\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with ltrunc' \"\n-\tgit log --pretty='format:%<(10,ltrunc)%s' >actual &&\n+test_expect_success 'left alignment formatting with ltrunc' '\n+\tgit log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n ..sage two\n ..sage one\n add bar  Z\n $(commit_msg \"\" \"0\" \".\\{11\\}\")\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with mtrunc' \"\n-\tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n+test_expect_success 'left alignment formatting with mtrunc' '\n+\tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n mess.. two\n mess.. one\n add bar  Z\n $(commit_msg \"\" \"4\" \".\\{11\\}\")\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'right alignment formatting' \"\n-\tgit log --pretty='format:%>(40)%s' >actual &&\n+test_expect_success 'right alignment formatting' '\n+\tgit log --pretty=\"format:%>(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n Z                            message two\n Z                            message one\n Z                                add bar\n Z                    $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'right alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %>|(40)%s' >actual &&\n+test_expect_success 'right alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %>|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1                      message two\n $head2                      message one\n $head3                          add bar\n $head4              $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'right alignment formatting with no padding' \"\n-\tgit log --pretty='format:%>(1)%s' >actual &&\n+test_expect_success 'right alignment formatting with no padding' '\n+\tgit log --pretty=\"format:%>(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'center alignment formatting' \"\n-\tgit log --pretty='format:%><(40)%s' >actual &&\n+test_expect_success 'center alignment formatting' '\n+\tgit log --pretty=\"format:%><(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n Z             message two              Z\n Z             message one              Z\n Z               add bar                Z\n Z         $(commit_msg)          Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'center alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %><|(40)%s' >actual &&\n+test_expect_success 'center alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %><|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1           message two          Z\n $head2           message one          Z\n $head3             add bar            Z\n $head4       $(commit_msg)      Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'center alignment formatting with no padding' \"\n-\tgit log --pretty='format:%><(1)%s' >actual &&\n+test_expect_success 'center alignment formatting with no padding' '\n+\tgit log --pretty=\"format:%><(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left/right alignment formatting with stealing' \"\n-\tgit commit --amend -m short --author 'long long long <long@me.com>' &&\n-\tgit log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&\n+test_expect_success 'left/right alignment formatting with stealing' '\n+\tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n+\tgit log --pretty=\"format:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n $(commit_msg \"\" \"8\" \"..*$\")   A U Thor\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n test_done\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222551","messageId":"aeb5182a691105600edc181c08020cfaa350c7df.1372939482.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372939482.git.Alex.Crezoff@gmail.com","subject":"[PATCH v9 3/5] t4205, t6006, t7102: make functions more readable","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-04T12:45:48Z","receivedAt":"2013-07-04T12:45:48Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Function 'test_format' is become hard to read after its change in\nde6029a2d7734a93a9e27b9c4471862a47dd8123. So, make it more elegant.\nAlso, change 'commit_msg' function to make it more pretty.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nImproved-by: Johannes Sixt <j.sixt@viscovery.net>\n---\n t/t4205-log-pretty-formats.sh |  5 +++--\n t/t6006-rev-list-format.sh    | 23 +++++------------------\n t/t7102-reset.sh              | 12 +++++++-----\n 3 files changed, 15 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex ef9770a..bb87f02 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -7,8 +7,9 @@\n test_description='Test pretty formats'\n . ./test-lib.sh\n \n-commit_msg () {\n-\t# String \"initial. initial\" partly in German (translated with Google Translate),\n+commit_msg() {\n+\t# String \"initial. initial\" partly in German\n+\t# (translated with Google Translate),\n \t# encoded in UTF-8, used as a commit log message below.\n \tmsg=$(printf \"initial. anf\\303\\244nglich\")\n \tif test -n \"$1\"\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 4751d22..e069263 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -35,26 +35,13 @@ test_expect_success 'setup' '\n \tgit config --unset i18n.commitEncoding\n '\n \n-# usage: test_format [failure] name format_string <expected_output\n+# usage: test_format name format_string [failure] <expected_output\n test_format () {\n-\tmust_fail=0\n-\t# if parameters count is more than 2 then test must fail\n-\tif test $# -gt 2\n-\tthen\n-\t\tmust_fail=1\n-\t\t# remove first parameter which is flag for test failure\n-\t\tshift\n-\tfi\n \tcat >expect.$1\n-\tname=\"format $1\"\n-\tcommand=\"git rev-list --pretty=format:'$2' master >output.$1 &&\n-\t\ttest_cmp expect.$1 output.$1\"\n-\tif test $must_fail -eq 1\n-\tthen\n-\t\ttest_expect_failure \"$name\" \"$command\"\n-\telse\n-\t\ttest_expect_success \"$name\" \"$command\"\n-\tfi\n+\ttest_expect_${3:-success} \"format $1\" \"\n+\t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n+\t\ttest_cmp expect.$1 output.$1\n+\t\"\n }\n \n # Feed to --format to provide predictable colored sequences.\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 2ef96e9..73a1bdb 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -9,15 +9,17 @@ Documented tests for git reset'\n \n . ./test-lib.sh\n \n-commit_msg () {\n-\t# String \"modify 2nd file (changed)\" partly in German(translated with Google Translate),\n+commit_msg() {\n+\t# String \"modify 2nd file (changed)\" partly in German\n+\t# (translated with Google Translate),\n \t# encoded in UTF-8, used as a commit log message below.\n-\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n+\tprintf \"modify 2nd file (ge\\303\\244ndert)\" |\n \tif test -n \"$1\"\n \tthen\n-\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\t\ticonv -f utf-8 -t $1\n+\telse\n+\t\tcat\n \tfi\n-\techo $msg\n }\n \n test_expect_success 'creating initial files and commits' '\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222552","messageId":"d1e6681bea4a69d4774b09e4cb776f4cd6e6dcc9.1372939482.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372939482.git.Alex.Crezoff@gmail.com","subject":"[PATCH v9 4/5] t6006: add two more tests for the case i18n.commitEncoding is not set","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-04T12:45:49Z","receivedAt":"2013-07-04T12:45:49Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"In de6029a2d7734a93a9e27b9c4471862a47dd8123 'complex-subject' test was\nchanged. Revert it back, and add two more tests to test encoding\nconversions with no i18n.commitEncoding set.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nReviewed-by: Johannes Sixt <j.sixt@viscovery.net>\n---\n t/t6006-rev-list-format.sh | 32 +++++++++++++++++++++++++-------\n 1 file changed, 25 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex e069263..843134f 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -217,12 +217,7 @@ test_expect_success 'setup complex body' '\n \tgit config i18n.commitencoding iso8859-1 &&\n \techo change2 >foo && git commit -a -F commit-msg &&\n \thead3=$(git rev-parse --verify HEAD) &&\n-\thead3_short=$(git rev-parse --short $head3) &&\n-\t# unset commit encoding config\n-\t# otherwise %e does not print encoding value\n-\t# and following test fails\n-\tgit config --unset i18n.commitEncoding\n-\n+\thead3_short=$(git rev-parse --short $head3)\n '\n \n test_format complex-encoding %e <<EOF\n@@ -238,12 +233,35 @@ test_format complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n+$changed_iso88591\n+commit $head1\n+$added_iso88591\n+EOF\n+\n+test_format complex-body %b <<EOF\n+commit $head3\n+This commit message is much longer than the others,\n+and it will be encoded in iso8859-1. We should therefore\n+include an iso8859 character: ¡bueno!\n+\n+commit $head2\n+commit $head1\n+EOF\n+\n+# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set\n+# so unset i18n.commitEncoding to test encoding conversion\n+git config --unset i18n.commitEncoding\n+\n+test_format complex-subject-commitencoding-unset %s <<EOF\n+commit $head3\n+Test printing of complex bodies\n+commit $head2\n $changed\n commit $head1\n $added\n EOF\n \n-test_format complex-body %b <<EOF\n+test_format complex-body-commitencoding-unset %b <<EOF\n commit $head3\n This commit message is much longer than the others,\n and it will be encoded in iso8859-1. We should therefore\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222550","messageId":"3c39c11346a5233c910ef15c2484915cdedde753.1372939482.git.Alex.Crezoff@gmail.com","threadId":"28440","inReplyTo":"cover.1372939482.git.Alex.Crezoff@gmail.com","subject":"[PATCH v9 5/5] t4205: avoid using `sed`","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-04T12:45:50Z","receivedAt":"2013-07-04T12:45:50Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"For testing truncated log messages 'commit_msg' function uses `sed` to\ncut a message. On various platforms `sed` behaves differently and\nresults of its work depend on locales installed. So, avoid using `sed`.\nUse predefined expected outputs instead of calculated ones.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4205-log-pretty-formats.sh | 26 ++++++++++----------------\n 1 file changed, 10 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex bb87f02..8504b13 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -7,25 +7,19 @@\n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+sample_utf8_part=$(printf \"f\\303\\244ng\")\n+\n commit_msg() {\n \t# String \"initial. initial\" partly in German\n \t# (translated with Google Translate),\n \t# encoded in UTF-8, used as a commit log message below.\n-\tmsg=$(printf \"initial. anf\\303\\244nglich\")\n+\tmsg=\"initial. an${sample_utf8_part}lich\"\n \tif test -n \"$1\"\n \tthen\n-\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n-\tfi\n-\tif test -n \"$2\" -a -n \"$3\"\n-\tthen\n-\t\t# cut string, replace cut part with two dots\n-\t\t# $2 - chars count from the beginning of the string\n-\t\t# $3 - \"trailing\" chars\n-\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n-\t\t# as it does with C locale\n-\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n+\t\techo $msg | iconv -f utf-8 -t $1\n+\telse\n+\t\techo $msg\n \tfi\n-\techo $msg\n }\n \n test_expect_success 'set up basic repos' '\n@@ -193,7 +187,7 @@ test_expect_success 'left alignment formatting with trunc' '\n message ..\n message ..\n add bar  Z\n-$(commit_msg \"\" \"8\" \"..*$\")\n+initial...\n EOF\n \ttest_cmp expected actual\n '\n@@ -206,7 +200,7 @@ test_expect_success 'left alignment formatting with ltrunc' '\n ..sage two\n ..sage one\n add bar  Z\n-$(commit_msg \"\" \"0\" \".\\{11\\}\")\n+..${sample_utf8_part}lich\n EOF\n \ttest_cmp expected actual\n '\n@@ -219,7 +213,7 @@ test_expect_success 'left alignment formatting with mtrunc' '\n mess.. two\n mess.. one\n add bar  Z\n-$(commit_msg \"\" \"4\" \".\\{11\\}\")\n+init..lich\n EOF\n \ttest_cmp expected actual\n '\n@@ -311,7 +305,7 @@ test_expect_success 'left/right alignment formatting with stealing' '\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n-$(commit_msg \"\" \"8\" \"..*$\")   A U Thor\n+initial...   A U Thor\n EOF\n \ttest_cmp expected actual\n '\n-- \n1.8.3.1.15.g5c23c1e\n"},{"id":"222597","messageId":"7v61wpbj2y.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"aeb5182a691105600edc181c08020cfaa350c7df.1372939482.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v9 3/5] t4205, t6006, t7102: make functions more readable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T06:45:57Z","receivedAt":"2013-07-05T06:45:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> Function 'test_format' is become hard to read after its change in\n> de6029a2d7734a93a9e27b9c4471862a47dd8123. So, make it more elegant.\n> Also, change 'commit_msg' function to make it more pretty.\n\nI do not know where you pick up these \"more elegant\" and \"more\npretty\" from, but please refrain from using _only_ such vague and\nsubjective phrases to describe the change in the log message.\nSaying \"make it <<better>> by doing X\" (with various subjective\nadjectives to say \"better\") is fine, but make sure you have \"doing\nX\" part in the explanation.\n\nPerhaps like this.\n\n    Function 'test_format' has become harder to read after its\n    change in de6029a2 (pretty: Add failing tests: --format output\n    should honor logOutputEncoding, 2013-06-26).  Simplify it by\n    moving its \"should we expect it to fail?\" parameter to the end.\n\nI cannot read why you think the updated commit_msg is \"more pretty\"\nin the message or in the patch.\n\n> -commit_msg () {\n> -\t# String \"initial. initial\" partly in German (translated with Google Translate),\n> +commit_msg() {\n\nStyle.  Have SP on both sides of () in a shell function definition.\n\n> +\t# String \"initial. initial\" partly in German\n> +\t# (translated with Google Translate),\n>  \t# encoded in UTF-8, used as a commit log message below.\n>  \tmsg=$(printf \"initial. anf\\303\\244nglich\")\n>  \tif test -n \"$1\"\n\nThis is not \"more pretty\" but \"better commented\".\n\n> diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\n> index 2ef96e9..73a1bdb 100755\n> --- a/t/t7102-reset.sh\n> +++ b/t/t7102-reset.sh\n> @@ -9,15 +9,17 @@ Documented tests for git reset'\n>  \n>  . ./test-lib.sh\n>  \n> -commit_msg () {\n> -\t# String \"modify 2nd file (changed)\" partly in German(translated with Google Translate),\n> +commit_msg() {\n> +\t# String \"modify 2nd file (changed)\" partly in German\n> +\t# (translated with Google Translate),\n>  \t# encoded in UTF-8, used as a commit log message below.\n> -\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n> +\tprintf \"modify 2nd file (ge\\303\\244ndert)\" |\n>  \tif test -n \"$1\"\n>  \tthen\n> -\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n> +\t\ticonv -f utf-8 -t $1\n> +\telse\n> +\t\tcat\n>  \tfi\n> -\techo $msg\n\nIs it \"more pretty\"?  The \"we have to have cat only because we want\nto pipe into a conditional\" look somewhat ugly.\n\n\tmsg=\"modify 2nd file (ge\\303\\244ndert)\"\n        if test -n \"$1\"\n\tthen\n\t\tprintf \"$msg\" | iconv -f utf-8 -t \"$1\"\n\telse\n\t\tprintf \"$msg\"\n\tfi\n\n>  }\n>  \n>  test_expect_success 'creating initial files and commits' '\n"},{"id":"222598","messageId":"7vy59la4gn.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"38cdab6c314e858ec580b1d0fbf87098c2d92cb0.1372939482.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v9 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T06:47:04Z","receivedAt":"2013-07-05T06:47:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> This is actually a fixup of de6029a2d7734a93a9e27b9c4471862a47dd8123,\n> which was applied before final patch series was sent.\n>\n> Also, see 3994e8a98dc7bbf67e61d23c8125f44383499a1f for the explanation\n> of such a replacement.\n\nThese are not very useful in a log message.  People who read the\nhistory 6 months down the road would want to see why we want to use\niso8859-1 not iso-8859-1 explained.\n\n\tBoth \"iso8859-1\" and \"iso-8859-1\" are understood as latin-1\n\tby modern platforms, but the latter is not understood by\n\tolder platforms;update tests to use the former.\n\n        This is in line with 3994e8a9 (t4201: use ISO8859-1 rather\n\tthan ISO-8859-1, 2009-12-03), which did the same.\n\n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> Reviewed-by: Johannes Sixt <j.sixt@viscovery.net>\n\nI do not recall this exact patch reviewed by J6t, but perhaps I\nmissed a message on the list?\n"},{"id":"222599","messageId":"7vobaha46x.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"d1e6681bea4a69d4774b09e4cb776f4cd6e6dcc9.1372939482.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v9 4/5] t6006: add two more tests for the case i18n.commitEncoding is not set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T06:52:54Z","receivedAt":"2013-07-05T06:52:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> In de6029a2d7734a93a9e27b9c4471862a47dd8123 'complex-subject' test was\n> changed. Revert it back,...\n\n... \"because changing it was bad for such and such reasons\"?\n"},{"id":"222601","messageId":"7vk3l5a3nh.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"d1e6681bea4a69d4774b09e4cb776f4cd6e6dcc9.1372939482.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v9 4/5] t6006: add two more tests for the case i18n.commitEncoding is not set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T07:04:34Z","receivedAt":"2013-07-05T07:04:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> +test_format complex-body %b <<EOF\n> +commit $head3\n> +This commit message is much longer than the others,\n> +and it will be encoded in iso8859-1. We should therefore\n> +include an iso8859 character: ¡bueno!\n\nThis is not such a good idea, as the resulting file will be in mixed\nencoding (it already has a line with non-ascii that is in UTF-8),\nand many editors would not like such a file.\n\nPerhaps we should update test_format so that we can feed a quoted\ninput, e.g.\n\n    +include an iso8859-1 character: <A1>bueno!\n\nor something?\n\n> +commit $head2\n> +commit $head1\n> +EOF\n> +\n> +# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set\n> +# so unset i18n.commitEncoding to test encoding conversion\n> +git config --unset i18n.commitEncoding\n> +\n> +test_format complex-subject-commitencoding-unset %s <<EOF\n> +commit $head3\n> +Test printing of complex bodies\n> +commit $head2\n>  $changed\n>  commit $head1\n>  $added\n>  EOF\n>  \n> -test_format complex-body %b <<EOF\n> +test_format complex-body-commitencoding-unset %b <<EOF\n>  commit $head3\n>  This commit message is much longer than the others,\n>  and it will be encoded in iso8859-1. We should therefore\n"},{"id":"222603","messageId":"7v61wpa3j6.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"b7ac1f5c14ab4571f06030ab02a33b1489ab4dcd.1372939482.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v9 2/5] t4205: revert back single quotes","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T07:07:09Z","receivedAt":"2013-07-05T07:07:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n> In previuos commit de6029a2d7734a93a9e27b9c4471862a47dd8123 single\n> quotes were replaced with double quotes to make \"$(commit_msg)\"\n> expression in heredoc to work. The same effect can be achieved by using\n> \"EOF\" as a heredoc delimiter instead of \"\\EOF\".\n\nOK.\n\n> -test_expect_success 'left alignment formatting' \"\n> -\tgit log --pretty='format:%<(40)%s' >actual &&\n> +test_expect_success 'left alignment formatting' '\n> +\tgit log --pretty=\"format:%<(40)%s\" >actual &&\n>  \t# complete the incomplete line at the end\n>  \techo >>actual &&\n> -\tqz_to_tab_space <<\\EOF >expected &&\n> +\tqz_to_tab_space <<EOF >expected &&\n>  message two                            Z\n>  message one                            Z\n>  add bar                                Z\n>  $(commit_msg)                    Z\n>  EOF\n>  \ttest_cmp expected actual\n> -\"\n> +'\n\nA subtle difference is that a call to commit_msg is made when the\ntest is actually run, not when the test script is prepared to be\npassed (as a parameter) to test_expect_success helper.  I think the\nresult of applying this patch, i.e. running $(commit_msg) inside the\ntest, is easier to read and understand.\n"},{"id":"222604","messageId":"20130705074644.GA32072@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vk3l5a3nh.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v9 4/5] t6006: add two more tests for the case i18n.commitEncoding is not set","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T07:46:44Z","receivedAt":"2013-07-05T07:46:44Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Fri, Jul 05, 2013 at 12:04:34AM -0700, Junio C Hamano wrote:\n> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> > +test_format complex-body %b <<EOF\n> > +commit $head3\n> > +This commit message is much longer than the others,\n> > +and it will be encoded in iso8859-1. We should therefore\n> > +include an iso8859 character: ¡bueno!\n> \n> This is not such a good idea, as the resulting file will be in mixed\n> encoding (it already has a line with non-ascii that is in UTF-8),\n> and many editors would not like such a file.\nI agree, there was issues when I edited that file\n> \n> Perhaps we should update test_format so that we can feed a quoted\n> input, e.g.\n> \n>     +include an iso8859-1 character: <A1>bueno!\n> \n> or something?\nWe could use this file whole in UTF-8 but just make a conversion of\nexpected output as it's done a few lines above with a commit message\n(stored to a file 'commit-msg' before the test 'setup complex body').\n    +iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF\n    +Test printing of complex bodies\nWe can even use content of that file (as far as it's kept untouched\nbetween that tests)\n\n> \n> > +commit $head2\n> > +commit $head1\n> > +EOF\n> > +\n> > +# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set\n> > +# so unset i18n.commitEncoding to test encoding conversion\n> > +git config --unset i18n.commitEncoding\n> > +\n> > +test_format complex-subject-commitencoding-unset %s <<EOF\n> > +commit $head3\n> > +Test printing of complex bodies\n> > +commit $head2\n> >  $changed\n> >  commit $head1\n> >  $added\n> >  EOF\n> >  \n> > -test_format complex-body %b <<EOF\n> > +test_format complex-body-commitencoding-unset %b <<EOF\n> >  commit $head3\n> >  This commit message is much longer than the others,\n> >  and it will be encoded in iso8859-1. We should therefore\n\n-- \nAlexey Shumkin\n"},{"id":"222605","messageId":"20130705080011.GB32072@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vy59la4gn.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v9 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T08:00:11Z","receivedAt":"2013-07-05T08:00:11Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Thu, Jul 04, 2013 at 11:47:04PM -0700, Junio C Hamano wrote:\n> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> > This is actually a fixup of de6029a2d7734a93a9e27b9c4471862a47dd8123,\n> > which was applied before final patch series was sent.\n> >\n> > Also, see 3994e8a98dc7bbf67e61d23c8125f44383499a1f for the explanation\n> > of such a replacement.\n> \n> These are not very useful in a log message.  People who read the\n> history 6 months down the road would want to see why we want to use\n> iso8859-1 not iso-8859-1 explained.\n> \n> \tBoth \"iso8859-1\" and \"iso-8859-1\" are understood as latin-1\n> \tby modern platforms, but the latter is not understood by\n> \tolder platforms;update tests to use the former.\n> \n>         This is in line with 3994e8a9 (t4201: use ISO8859-1 rather\n> \tthan ISO-8859-1, 2009-12-03), which did the same.\nYep, it whould be better, I thought to do like this but I didn't )\n> \n> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> > Reviewed-by: Johannes Sixt <j.sixt@viscovery.net>\n> \n> I do not recall this exact patch reviewed by J6t, but perhaps I\n> missed a message on the list?\nI've reread 'SubmittingPatches' doc, and I can say I used \"Reviewed-by\"\nincorrectly. Sorry for this. It must be \"Suggested-by\" there, I guess.\n\n\n-- \nAlexey Shumkin\n"},{"id":"222606","messageId":"7v1u7da0mj.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"20130705074644.GA32072@ashu.dyn1.rarus.ru","subject":"Re: [PATCH v9 4/5] t6006: add two more tests for the case i18n.commitEncoding is not set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T08:09:56Z","receivedAt":"2013-07-05T08:09:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n>> Perhaps we should update test_format so that we can feed a quoted\n>> input, e.g.\n>> \n>>     +include an iso8859-1 character: <A1>bueno!\n>> \n>> or something?\n> We could use this file whole in UTF-8 but just make a conversion of\n> expected output as it's done a few lines above with a commit message\n> (stored to a file 'commit-msg' before the test 'setup complex body').\n>     +iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF\n>     +Test printing of complex bodies\n\nThat is way better than my <A1>bueno!.\n\nThanks.\n"},{"id":"222607","messageId":"7vwqp58lyy.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"20130705080011.GB32072@ashu.dyn1.rarus.ru","subject":"Re: [PATCH v9 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T08:11:49Z","receivedAt":"2013-07-05T08:11:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n>> \tBoth \"iso8859-1\" and \"iso-8859-1\" are understood as latin-1\n>> \tby modern platforms, but the latter is not understood by\n>> \tolder platforms;update tests to use the former.\n>> \n>>         This is in line with 3994e8a9 (t4201: use ISO8859-1 rather\n>> \tthan ISO-8859-1, 2009-12-03), which did the same.\n> Yep, it whould be better, I thought to do like this but I didn't )\n>> \n>> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n>> > Reviewed-by: Johannes Sixt <j.sixt@viscovery.net>\n>> \n>> I do not recall this exact patch reviewed by J6t, but perhaps I\n>> missed a message on the list?\n> I've reread 'SubmittingPatches' doc, and I can say I used \"Reviewed-by\"\n> incorrectly. Sorry for this. It must be \"Suggested-by\" there, I guess.\n\nOK, then I'll queue this patch (but not 2-4/5 yet) with log message\namended.\n\nThanks.\n"},{"id":"222608","messageId":"20130705081307.GC32072@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7v61wpbj2y.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v9 3/5] t4205, t6006, t7102: make functions more readable","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T08:13:07Z","receivedAt":"2013-07-05T08:13:07Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Thu, Jul 04, 2013 at 11:45:57PM -0700, Junio C Hamano wrote:\n> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> > Function 'test_format' is become hard to read after its change in\n> > de6029a2d7734a93a9e27b9c4471862a47dd8123. So, make it more elegant.\n> > Also, change 'commit_msg' function to make it more pretty.\n> \n> I do not know where you pick up these \"more elegant\" and \"more\n> pretty\" from, but please refrain from using _only_ such vague and\n> subjective phrases to describe the change in the log message.\n> Saying \"make it <<better>> by doing X\" (with various subjective\n> adjectives to say \"better\") is fine, but make sure you have \"doing\n> X\" part in the explanation.\n> \n> Perhaps like this.\n> \n>     Function 'test_format' has become harder to read after its\n>     change in de6029a2 (pretty: Add failing tests: --format output\n>     should honor logOutputEncoding, 2013-06-26).  Simplify it by\n>     moving its \"should we expect it to fail?\" parameter to the end.\nI'm not sure whether this \"last parameter\" is needed in that code as far as we\nalready removed expected to fail tests\n> \n> I cannot read why you think the updated commit_msg is \"more pretty\"\n> in the message or in the patch.\n> \n> > -commit_msg () {\n> > -\t# String \"initial. initial\" partly in German (translated with Google Translate),\n> > +commit_msg() {\n> \n> Style.  Have SP on both sides of () in a shell function definition.\nCould you point me to the coding style guide, please?\n> \n> > +\t# String \"initial. initial\" partly in German\n> > +\t# (translated with Google Translate),\n> >  \t# encoded in UTF-8, used as a commit log message below.\n> >  \tmsg=$(printf \"initial. anf\\303\\244nglich\")\n> >  \tif test -n \"$1\"\n> \n> This is not \"more pretty\" but \"better commented\".\nWell, this is \"better formatted comment\", I guess :)\n> \n> > diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\n> > index 2ef96e9..73a1bdb 100755\n> > --- a/t/t7102-reset.sh\n> > +++ b/t/t7102-reset.sh\n> > @@ -9,15 +9,17 @@ Documented tests for git reset'\n> >  \n> >  . ./test-lib.sh\n> >  \n> > -commit_msg () {\n> > -\t# String \"modify 2nd file (changed)\" partly in German(translated with Google Translate),\n> > +commit_msg() {\n> > +\t# String \"modify 2nd file (changed)\" partly in German\n> > +\t# (translated with Google Translate),\n> >  \t# encoded in UTF-8, used as a commit log message below.\n> > -\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n> > +\tprintf \"modify 2nd file (ge\\303\\244ndert)\" |\n> >  \tif test -n \"$1\"\n> >  \tthen\n> > -\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n> > +\t\ticonv -f utf-8 -t $1\n> > +\telse\n> > +\t\tcat\n> >  \tfi\n> > -\techo $msg\n> \n> Is it \"more pretty\"?  The \"we have to have cat only because we want\n> to pipe into a conditional\" look somewhat ugly.\nThat was a proposition of J6t :-D\n(see http://article.gmane.org/gmane.comp.version-control.git/229291):\n    >If you wanted to, you could write this as\n    >\n    >commit_msg () {\n    >    # String \"modify 2nd file (changed)\" partly in German\n    >    #(translated with Google Translate),\n    >    # encoded in UTF-8, used as a commit log message below.\n    >    printf \"modify 2nd file (ge\\303\\244ndert)\" |\n    >    if test -n \"$1\"\n    >    then\n    >        iconv -f utf-8 -t $1\n    >    else\n    >        cat\n    >    fi\n    >}\n    >\n    >but I'm not sure whether it's a lot better.\n\nLast sentence has apperared to be a key\n\n> \n> \tmsg=\"modify 2nd file (ge\\303\\244ndert)\"\n>         if test -n \"$1\"\n> \tthen\n> \t\tprintf \"$msg\" | iconv -f utf-8 -t \"$1\"\n> \telse\n> \t\tprintf \"$msg\"\n> \tfi\n> \n> >  }\n> >  \n> >  test_expect_success 'creating initial files and commits' '\n\n-- \nAlexey Shumkin\n"},{"id":"222611","messageId":"20130705084241.GD32072@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vwqp58lyy.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v9 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T08:42:41Z","receivedAt":"2013-07-05T08:42:41Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Fri, Jul 05, 2013 at 01:11:49AM -0700, Junio C Hamano wrote:\n> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> >> \tBoth \"iso8859-1\" and \"iso-8859-1\" are understood as latin-1\n> >> \tby modern platforms, but the latter is not understood by\n> >> \tolder platforms;update tests to use the former.\n> >> \n> >>         This is in line with 3994e8a9 (t4201: use ISO8859-1 rather\n> >> \tthan ISO-8859-1, 2009-12-03), which did the same.\n> > Yep, it whould be better, I thought to do like this but I didn't )\n> >> \n> >> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> >> > Reviewed-by: Johannes Sixt <j.sixt@viscovery.net>\n> >> \n> >> I do not recall this exact patch reviewed by J6t, but perhaps I\n> >> missed a message on the list?\n> > I've reread 'SubmittingPatches' doc, and I can say I used \"Reviewed-by\"\n> > incorrectly. Sorry for this. It must be \"Suggested-by\" there, I guess.\n> \n> OK, then I'll queue this patch (but not 2-4/5 yet) with log message\n> amended.\nExcuse me, you've said \"Ok\" for 2/5 message, and then explained (as I\nunderstood) then \"subtle difference\" between EOF and \\EOF.\nShould I change the message somehow?\n> \n> Thanks.\n\n-- \nAlexey Shumkin\n"},{"id":"222612","messageId":"7vsizt8kh4.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"20130705081307.GC32072@ashu.dyn1.rarus.ru","subject":"Re: [PATCH v9 3/5] t4205, t6006, t7102: make functions more readable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T08:44:07Z","receivedAt":"2013-07-05T08:44:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n>> Perhaps like this.\n>> \n>>     Function 'test_format' has become harder to read after its\n>>     change in de6029a2 (pretty: Add failing tests: --format output\n>>     should honor logOutputEncoding, 2013-06-26).  Simplify it by\n>>     moving its \"should we expect it to fail?\" parameter to the end.\n> I'm not sure whether this \"last parameter\" is needed in that code as far as we\n> already removed expected to fail tests\n\nWhatever.\n\nThe above is an example of justifying a more vague \"simple\" (\"is\nbetter\" is implied) with a concrete point (i.e. By moving that to\nthe end, you removed the need to conditionally shift $@ in the\nfunction to simplify the codepath), based on my _guess_ of what you\npossibly meant to say, from reading your description that did not\ngive much clue for me to guess why you thought the result was \"more\nelegant\".  If my guess missed what your true justification was,\nplease replace it with the more correct one ;-)\n\n>> I cannot read why you think the updated commit_msg is \"more pretty\"\n>> in the message or in the patch.\n>> \n>> > -commit_msg () {\n>> > -\t# String \"initial. initial\" partly in German (translated with Google Translate),\n>> > +commit_msg() {\n>> \n>> Style.  Have SP on both sides of () in a shell function definition.\n> Could you point me to the coding style guide, please?\n\nDocumentation/CodingGuidelines::\n\n - We prefer a space between the function name and the parentheses. The\n   opening \"{\" should also be on the same line.\n   E.g.: my_function () {\n"},{"id":"222613","messageId":"20130705085112.GE32072@ashu.dyn1.rarus.ru","threadId":"28440","inReplyTo":"7vsizt8kh4.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v9 3/5] t4205, t6006, t7102: make functions more readable","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T08:51:12Z","receivedAt":"2013-07-05T08:51:12Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Fri, Jul 05, 2013 at 01:44:07AM -0700, Junio C Hamano wrote:\n> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> >> Perhaps like this.\n> >> \n> >>     Function 'test_format' has become harder to read after its\n> >>     change in de6029a2 (pretty: Add failing tests: --format output\n> >>     should honor logOutputEncoding, 2013-06-26).  Simplify it by\n> >>     moving its \"should we expect it to fail?\" parameter to the end.\n> > I'm not sure whether this \"last parameter\" is needed in that code as far as we\n> > already removed expected to fail tests\n> \n> Whatever.\n> \n> The above is an example of justifying a more vague \"simple\" (\"is\n> better\" is implied) with a concrete point (i.e. By moving that to\n> the end, you removed the need to conditionally shift $@ in the\n> function to simplify the codepath), based on my _guess_ of what you\n> possibly meant to say, from reading your description that did not\n> give much clue for me to guess why you thought the result was \"more\n> elegant\".  If my guess missed what your true justification was,\n> please replace it with the more correct one ;-)\nOk\n> \n> >> I cannot read why you think the updated commit_msg is \"more pretty\"\n> >> in the message or in the patch.\n> >> \n> >> > -commit_msg () {\n> >> > -\t# String \"initial. initial\" partly in German (translated with Google Translate),\n> >> > +commit_msg() {\n> >> \n> >> Style.  Have SP on both sides of () in a shell function definition.\n> > Could you point me to the coding style guide, please?\n> \n> Documentation/CodingGuidelines::\nOh! :)\nthank you\n>  \n>  - We prefer a space between the function name and the parentheses. The\n>    opening \"{\" should also be on the same line.\n>    E.g.: my_function () {\nAha\n\n-- \nAlexey Shumkin\n"},{"id":"222614","messageId":"7vobah8jwo.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"20130705084241.GD32072@ashu.dyn1.rarus.ru","subject":"Re: [PATCH v9 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T08:56:23Z","receivedAt":"2013-07-05T08:56:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n>> OK, then I'll queue this patch (but not 2-4/5 yet) with log message\n>> amended.\n> Excuse me, you've said \"Ok\" for 2/5 message, and then explained (as I\n> understood) then \"subtle difference\" between EOF and \\EOF.\n> Should I change the message somehow?\n\nI left it up to you.  If I queued without waiting, it wouldn't have\nbeen up-to-you, so...\n"},{"id":"222615","messageId":"7vk3l58jts.fsf@alter.siamese.dyndns.org","threadId":"28440","inReplyTo":"20130705085112.GE32072@ashu.dyn1.rarus.ru","subject":"Re: [PATCH v9 3/5] t4205, t6006, t7102: make functions more readable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T08:58:07Z","receivedAt":"2013-07-05T08:58:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alexey Shumkin <alex.crezoff@gmail.com> writes:\n\n>> > Could you point me to the coding style guide, please?\n>> \n>> Documentation/CodingGuidelines::\n> Oh! :)\n> thank you\n\nThe most important part of the coding guidelines is to match the\nstyle to existing code when writing a new one:\n\n    $ git grep '^[a-z_]* ()' -- *.sh | wc -l\n    132\n    $ git grep '^[a-z_]*()' -- *.sh | wc -l\n    55\n\nWe have acquired quite a few violators, but that is no reason to add\nmore.\n"}]}