{"thread":{"id":"36676","subject":"[PATCH 0/2] Pretty print truncate does not work","startedAt":"2014-05-16T13:06:29Z","lastAt":"2014-05-21T18:11:47Z","messageCount":25,"participants":["Alexey Shumkin","Duy Nguyen","Junio C Hamano","brian m. carlson","Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"241882","messageId":"cover.1400242108.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":null,"subject":"[PATCH 0/2] Pretty print truncate does not work","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-16T13:06:29Z","receivedAt":"2014-05-16T13:06:29Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nFollowing patches are:\n1. failing tests\n2. Fix patch\n\nAlexey Shumkin (2):\n  t4205 (log-pretty-formats): Add failing tests for the case when\n    i18n.logOutputEncoding is set\n  pretty.c: format string with truncate respects logOutputEncoding\n\n pretty.c                      |   7 +-\n t/t4205-log-pretty-formats.sh | 169 ++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 174 insertions(+), 2 deletions(-)\n\n-- \n1.9.2-15\n"},{"id":"241883","messageId":"b3195b5f42e11400643efd70b66cb4b7b8d221f4.1400242108.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400242108.git.Alex.Crezoff@gmail.com","subject":"[PATCH 1/2] t4205 (log-pretty-formats): Add failing tests for the case when i18n.logOutputEncoding is set","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-16T13:06:30Z","receivedAt":"2014-05-16T13:06:30Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nThere were no breakages as far as were no tests for the case\nwhen both a commit message and logOutputEncoding are not UTF-8.\n\nAdd failing tests for that which will be fixed in the next patch.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 169 ++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 169 insertions(+)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 2a6278b..6791e0d 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -153,6 +153,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(40)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t iso8859-1 >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 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@@ -166,6 +179,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >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 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@@ -179,6 +205,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(1)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tcat <<EOF | iconv -f utf-8 -t iso8859-1 >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -192,6 +231,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >expected &&\n+message ..\n+message ..\n+add bar  Z\n+initial...\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -205,6 +257,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >expected &&\n+..sage two\n+..sage one\n+add bar  Z\n+..${sample_utf8_part}lich\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -218,6 +283,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >expected &&\n+mess.. two\n+mess.. one\n+add bar  Z\n+init..lich\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -231,6 +309,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%>(40)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t iso8859-1 >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 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@@ -244,6 +335,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >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 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@@ -257,6 +361,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%>(1)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tcat <<EOF | iconv -f utf-8 -t iso8859-1 >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -270,6 +387,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%><(40)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t iso8859-1 >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 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@@ -283,6 +412,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >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 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@@ -296,6 +438,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%><(1)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tcat <<EOF | iconv -f utf-8 -t iso8859-1 >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\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@@ -310,6 +465,20 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n+\tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >expected &&\n+short long  long long\n+message ..   A U Thor\n+add bar      A U Thor\n+initial...   A U Thor\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'log decoration properly follows tag chain' '\n \tgit tag -a tag1 -m tag1 &&\n \tgit tag -a tag2 -m tag2 tag1 &&\n-- \n1.9.2-15\n"},{"id":"241884","messageId":"b8aa002298a5e96be3a79406b0d120f001364851.1400242108.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400242108.git.Alex.Crezoff@gmail.com","subject":"[PATCH 2/2] pretty.c: format string with truncate respects logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-16T13:06:31Z","receivedAt":"2014-05-16T13:06:31Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nIn 7e77df3 (pretty: two phase conversion for non utf-8 commits, 2013-04-19)\n'format_commit_item' function assumes commit message to be in UTF-8.\nAnd that was so until ecaee80 (pretty: --format output should honor\nlogOutputEncoding, 2013-06-26) where conversion to logOutputEncoding was\nadded before calling 'format_commit_message'.\n\nCorrect this by converting a commit message to UTF-8 first (as it\nassumed in 7e77df3 (pretty: two phase conversion for non utf-8 commits,\n2013-04-19)). Only after that set 'output_enc' variable to an actual\nlogOutputEncoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n pretty.c                      | 7 +++++--\n t/t4205-log-pretty-formats.sh | 8 ++++----\n 2 files changed, 9 insertions(+), 6 deletions(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 6e266dd..7eb43c1 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1500,16 +1500,19 @@ void format_commit_message(const struct commit *commit,\n \t\t\t   const struct pretty_print_context *pretty_ctx)\n {\n \tstruct format_commit_context context;\n-\tconst char *output_enc = pretty_ctx->output_encoding;\n \tconst char *utf8 = \"UTF-8\";\n \n \tmemset(&context, 0, sizeof(context));\n \tcontext.commit = commit;\n \tcontext.pretty_ctx = pretty_ctx;\n \tcontext.wrap_start = sb->len;\n+\t// convert a commit message to UTF-8 first\n+\t// as far as 'format_commit_item' assumes it in UTF-8\n \tcontext.message = logmsg_reencode(commit,\n \t\t\t\t\t  &context.commit_encoding,\n-\t\t\t\t\t  output_enc);\n+\t\t\t\t\t  utf8);\n+\t// then convert to an actual output encoding\n+\tconst char *output_enc = pretty_ctx->output_encoding;\n \n \tstrbuf_expand(sb, format, format_commit_item, &context);\n \trewrap_message_tail(sb, &context, 0, 0, 0);\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 6791e0d..7426fe2 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -231,7 +231,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -257,7 +257,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -283,7 +283,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -465,7 +465,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n+test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n \tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n \tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \t# complete the incomplete line at the end\n-- \n1.9.2-15\n"},{"id":"241887","messageId":"CACsJy8B20XMiNqtG9c-cLERd8-zahcvWU=UnY80ZJUmLD91ZKg@mail.gmail.com","threadId":"36676","inReplyTo":"b8aa002298a5e96be3a79406b0d120f001364851.1400242108.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH 2/2] pretty.c: format string with truncate respects logOutputEncoding","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-05-16T13:44:47Z","receivedAt":"2014-05-16T13:44:47Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"And I thought I was the only one using this :)\n\n> diff --git a/pretty.c b/pretty.c\n> index 6e266dd..7eb43c1 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -1500,16 +1500,19 @@ void format_commit_message(const struct commit *commit,\n>                            const struct pretty_print_context *pretty_ctx)\n>  {\n>         struct format_commit_context context;\n> -       const char *output_enc = pretty_ctx->output_encoding;\n>         const char *utf8 = \"UTF-8\";\n>\n>         memset(&context, 0, sizeof(context));\n>         context.commit = commit;\n>         context.pretty_ctx = pretty_ctx;\n>         context.wrap_start = sb->len;\n> +       // convert a commit message to UTF-8 first\n> +       // as far as 'format_commit_item' assumes it in UTF-8\n>         context.message = logmsg_reencode(commit,\n>                                           &context.commit_encoding,\n> -                                         output_enc);\n> +                                         utf8);\n> +       // then convert to an actual output encoding\n> +       const char *output_enc = pretty_ctx->output_encoding;\n>\n>         strbuf_expand(sb, format, format_commit_item, &context);\n>         rewrap_message_tail(sb, &context, 0, 0, 0);\n\nIt looks ok except minor issues, use C comment syntax, not C++ and\nvariable declaration not in the middle of the body.\n-- \nDuy\n"},{"id":"241931","messageId":"cover.1400254654.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"CACsJy8B20XMiNqtG9c-cLERd8-zahcvWU=UnY80ZJUmLD91ZKg@mail.gmail.com","subject":"[PATCH v2 0/2] Reroll patch series. Pretty print truncate does not work","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-16T15:40:31Z","receivedAt":"2014-05-16T15:40:31Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"In this reroll (against v1) remarks of Nguyễn are respected.\nComments style changed from C++ to C. variable declaration moved back to\nthe beginning of a function.\nAlso, added tests for the same case for git rev-list\n(see t6006-rev-list-format.sh)\n\nAlexey Shumkin (2):\n  t4205, t6006: Add failing tests for the case when\n    i18n.logOutputEncoding is set\n  pretty.c: format string with truncate respects logOutputEncoding\n\n pretty.c                      |   7 +-\n t/t4205-log-pretty-formats.sh | 169 ++++++++++++++++++++++++++++++++++++++++++\n t/t6006-rev-list-format.sh    |  75 ++++++++++++++++++-\n 3 files changed, 248 insertions(+), 3 deletions(-)\n\n-- \n1.9.2-17\n"},{"id":"241932","messageId":"c4c360c3e6760128ae1326b7463da7130b01a7e9.1400254654.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400254654.git.Alex.Crezoff@gmail.com","subject":"[PATCH v2 1/2] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-16T15:40:32Z","receivedAt":"2014-05-16T15:40:32Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nThere were no breakages as far as were no tests for the case\nwhen both a commit message and logOutputEncoding are not UTF-8.\n\nAdd failing tests for that which will be fixed in the next patch.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nReviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 169 ++++++++++++++++++++++++++++++++++++++++++\n t/t6006-rev-list-format.sh    |  75 ++++++++++++++++++-\n 2 files changed, 242 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 2a6278b..6791e0d 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -153,6 +153,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(40)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t iso8859-1 >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 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@@ -166,6 +179,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >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 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@@ -179,6 +205,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(1)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tcat <<EOF | iconv -f utf-8 -t iso8859-1 >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -192,6 +231,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >expected &&\n+message ..\n+message ..\n+add bar  Z\n+initial...\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -205,6 +257,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >expected &&\n+..sage two\n+..sage one\n+add bar  Z\n+..${sample_utf8_part}lich\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -218,6 +283,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >expected &&\n+mess.. two\n+mess.. one\n+add bar  Z\n+init..lich\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -231,6 +309,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%>(40)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t iso8859-1 >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 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@@ -244,6 +335,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >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 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@@ -257,6 +361,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%>(1)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tcat <<EOF | iconv -f utf-8 -t iso8859-1 >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\n+'\n+\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@@ -270,6 +387,18 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%><(40)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t iso8859-1 >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 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@@ -283,6 +412,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >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 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@@ -296,6 +438,19 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%><(1)%s\" >actual &&\n+\t# complete the incomplete line at the end\n+\techo >>actual &&\n+\tcat <<EOF | iconv -f utf-8 -t iso8859-1 >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\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@@ -310,6 +465,20 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n+\tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n+\tgit -c i18n.logOutputEncoding=iso8859-1 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 | iconv -f utf-8 -t iso8859-1 >expected &&\n+short long  long long\n+message ..   A U Thor\n+add bar      A U Thor\n+initial...   A U Thor\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'log decoration properly follows tag chain' '\n \tgit tag -a tag1 -m tag1 &&\n \tgit tag -a tag2 -m tag2 tag1 &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 9874403..09cdf24 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -12,12 +12,22 @@ test_tick\n # String \"added\" in German\n # (translated with Google Translate),\n # encoded in UTF-8, used as a commit log message below.\n-added=$(printf \"added (hinzugef\\303\\274gt) foo\")\n+added_utf8_part=$(printf \"\\303\\274\")\n+added_utf8_part_iso88591=$(echo \"$added_utf8_part\" | iconv -f utf-8 -t iso8859-1)\n+added=$(printf \"added (hinzugef${added_utf8_part}gt) 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_utf8_part=$(printf \"\\303\\244\")\n+changed_utf8_part_iso88591=$(echo \"$changed_utf8_part\" | iconv -f utf-8 -t iso8859-1)\n+changed=$(printf \"changed (ge${changed_utf8_part}ndert) foo\")\n changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t iso8859-1)\n \n+# count of char to truncate\n+# numbers is chosen so, that non-ACSII characters\n+# (see $added_utf8_part and $changed_utf8_part)\n+# fall into truncated parts of appropriate words both from left and right\n+truncate_count=20\n+\n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n@@ -136,6 +146,13 @@ commit $head1\n $added\n EOF\n \n+test_format subject-truncated %<($truncate_count,trunc)%s <<EOF\n+commit $head2\n+changed (ge${changed_utf8_part}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part}gt..\n+EOF\n+\n test_format body %b <<EOF\n commit $head2\n commit $head1\n@@ -239,6 +256,33 @@ commit $head1\n $added_iso88591\n EOF\n \n+test_format complex-subject-trunc %<($truncate_count,trunc)%s failure <<EOF\n+commit $head3\n+Test printing of c..\n+commit $head2\n+changed (ge${changed_utf8_part_iso88591}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part_iso88591}gt..\n+EOF\n+\n+test_format complex-subject-mtrunc %<($truncate_count,mtrunc)%s failure <<EOF\n+commit $head3\n+Test prin..ex bodies\n+commit $head2\n+changed (..dert) foo\n+commit $head1\n+added (hi..f${added_utf8_part_iso88591}gt) foo\n+EOF\n+\n+test_format complex-subject-ltrunc %<($truncate_count,ltrunc)%s failure <<EOF\n+commit $head3\n+.. of complex bodies\n+commit $head2\n+..ged (ge${changed_utf8_part_iso88591}ndert) foo\n+commit $head1\n+.. (hinzugef${added_utf8_part_iso88591}gt) foo\n+EOF\n+\n test_expect_success 'prepare expected messages (for test %b)' '\n \tcat <<-EOF >expected.utf-8 &&\n \tcommit $head3\n@@ -267,6 +311,33 @@ commit $head1\n $added\n EOF\n \n+test_format complex-subject-commitencoding-unset-trunc %<($truncate_count,trunc)%s <<EOF\n+commit $head3\n+Test printing of c..\n+commit $head2\n+changed (ge${changed_utf8_part}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part}gt..\n+EOF\n+\n+test_format complex-subject-commitencoding-unset-mtrunc %<($truncate_count,mtrunc)%s <<EOF\n+commit $head3\n+Test prin..ex bodies\n+commit $head2\n+changed (..dert) foo\n+commit $head1\n+added (hi..f${added_utf8_part}gt) foo\n+EOF\n+\n+test_format complex-subject-commitencoding-unset-ltrunc %<($truncate_count,ltrunc)%s <<EOF\n+commit $head3\n+.. of complex bodies\n+commit $head2\n+..ged (ge${changed_utf8_part}ndert) foo\n+commit $head1\n+.. (hinzugef${added_utf8_part}gt) foo\n+EOF\n+\n test_format complex-body-commitencoding-unset %b <expected.utf-8\n \n test_expect_success '%x00 shows NUL' '\n-- \n1.9.2-17\n"},{"id":"241933","messageId":"01a8e808974159833cc18fe8e5ab1ac7ea4e8369.1400254654.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400254654.git.Alex.Crezoff@gmail.com","subject":"[PATCH v2 2/2] pretty.c: format string with truncate respects logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-16T15:40:33Z","receivedAt":"2014-05-16T15:40:33Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nIn 7e77df3 (pretty: two phase conversion for non utf-8 commits, 2013-04-19)\n'format_commit_item' function assumes commit message to be in UTF-8.\nAnd that was so until ecaee80 (pretty: --format output should honor\nlogOutputEncoding, 2013-06-26) where conversion to logOutputEncoding was\nadded before calling 'format_commit_message'.\n\nCorrect this by converting a commit message to UTF-8 first (as it\nassumed in 7e77df3 (pretty: two phase conversion for non utf-8 commits,\n2013-04-19)). Only after that convert a commit message to an actual\nlogOutputEncoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nReviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n pretty.c                      | 7 ++++++-\n t/t4205-log-pretty-formats.sh | 8 ++++----\n t/t6006-rev-list-format.sh    | 6 +++---\n 3 files changed, 13 insertions(+), 8 deletions(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 6e266dd..25e8825 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1507,13 +1507,18 @@ void format_commit_message(const struct commit *commit,\n \tcontext.commit = commit;\n \tcontext.pretty_ctx = pretty_ctx;\n \tcontext.wrap_start = sb->len;\n+\t/*\n+\t * convert a commit message to UTF-8 first\n+\t * as far as 'format_commit_item' assumes it in UTF-8\n+\t */\n \tcontext.message = logmsg_reencode(commit,\n \t\t\t\t\t  &context.commit_encoding,\n-\t\t\t\t\t  output_enc);\n+\t\t\t\t\t  utf8);\n \n \tstrbuf_expand(sb, format, format_commit_item, &context);\n \trewrap_message_tail(sb, &context, 0, 0, 0);\n \n+\t/* then convert a commit message to an actual output encoding */\n \tif (output_enc) {\n \t\tif (same_encoding(utf8, output_enc))\n \t\t\toutput_enc = NULL;\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 6791e0d..7426fe2 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -231,7 +231,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -257,7 +257,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -283,7 +283,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n@@ -465,7 +465,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n+test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n \tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n \tgit -c i18n.logOutputEncoding=iso8859-1 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 09cdf24..04811fd 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -256,7 +256,7 @@ commit $head1\n $added_iso88591\n EOF\n \n-test_format complex-subject-trunc %<($truncate_count,trunc)%s failure <<EOF\n+test_format complex-subject-trunc %<($truncate_count,trunc)%s <<EOF\n commit $head3\n Test printing of c..\n commit $head2\n@@ -265,7 +265,7 @@ commit $head1\n added (hinzugef${added_utf8_part_iso88591}gt..\n EOF\n \n-test_format complex-subject-mtrunc %<($truncate_count,mtrunc)%s failure <<EOF\n+test_format complex-subject-mtrunc %<($truncate_count,mtrunc)%s <<EOF\n commit $head3\n Test prin..ex bodies\n commit $head2\n@@ -274,7 +274,7 @@ commit $head1\n added (hi..f${added_utf8_part_iso88591}gt) foo\n EOF\n \n-test_format complex-subject-ltrunc %<($truncate_count,ltrunc)%s failure <<EOF\n+test_format complex-subject-ltrunc %<($truncate_count,ltrunc)%s <<EOF\n commit $head3\n .. of complex bodies\n commit $head2\n-- \n1.9.2-17\n"},{"id":"241993","messageId":"xmqqfvk9a797.fsf@gitster.dls.corp.google.com","threadId":"36676","inReplyTo":"c4c360c3e6760128ae1326b7463da7130b01a7e9.1400254654.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v2 1/2] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-05-16T18:49:40Z","receivedAt":"2014-05-16T18:49:40Z","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> Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\n> length with an appropriate padding. This works for non-ASCII texts when\n> i18n.logOutputEncoding is UTF-8 only (independently of a printed commit\n> message encoding) but does not work when i18n.logOutputEncoding is NOT\n> UTF-8.\n>\n> There were no breakages as far as were no tests for the case\n> when both a commit message and logOutputEncoding are not UTF-8.\n>\n> Add failing tests for that which will be fixed in the next patch.\n>\n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  t/t4205-log-pretty-formats.sh | 169 ++++++++++++++++++++++++++++++++++++++++++\n>  t/t6006-rev-list-format.sh    |  75 ++++++++++++++++++-\n>  2 files changed, 242 insertions(+), 2 deletions(-)\n>\n> diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> index 2a6278b..6791e0d 100755\n> --- a/t/t4205-log-pretty-formats.sh\n> +++ b/t/t4205-log-pretty-formats.sh\n> @@ -153,6 +153,19 @@ EOF\n>  \ttest_cmp expected actual\n>  '\n>  \n> +test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '\n> +\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(40)%s\" >actual &&\n> +\t# complete the incomplete line at the end\n> +\techo >>actual &&\n\nWould it change the meaning of the test if you used tformat: instead\nof format: (or --format=\"%<(40)%s\")?  If it doesn't, it would make\nit unnecessary to append an extra LF and explain why you do so.\n\n> +\tqz_to_tab_space <<EOF | iconv -f utf-8 -t iso8859-1 >expected &&\n\nIt is minor but many existing uses of iconv in our tests spell these\nas UTF-8 and ISO8859-1 in uppercase.  I vaguely recall there was a\nportability concern to favor the ones that are used in existing\ntests, but probably it no longer matters (I see you added the\nlowercase one with de6029a2 mid last year), so I am fine if these\nstay lowercase.\n\n> +\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(1)%s\" >actual &&\n> +\t# complete the incomplete line at the end\n> +\techo >>actual &&\n\nLikewise for all the other \"--pretty=format:\" followed by an echo.\n\nThanks.\n"},{"id":"242041","messageId":"20140517085203.GA27165@dell-note","threadId":"36676","inReplyTo":"xmqqfvk9a797.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2 1/2] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-17T08:52:03Z","receivedAt":"2014-05-17T08:52:03Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Fri, May 16, 2014 at 11:49:40AM -0700, Junio C Hamano wrote:\n> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n> \n> > Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\n> > length with an appropriate padding. This works for non-ASCII texts when\n> > i18n.logOutputEncoding is UTF-8 only (independently of a printed commit\n> > message encoding) but does not work when i18n.logOutputEncoding is NOT\n> > UTF-8.\n> >\n> > There were no breakages as far as were no tests for the case\n> > when both a commit message and logOutputEncoding are not UTF-8.\n> >\n> > Add failing tests for that which will be fixed in the next patch.\n> >\n> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> > Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> > ---\n> >  t/t4205-log-pretty-formats.sh | 169 ++++++++++++++++++++++++++++++++++++++++++\n> >  t/t6006-rev-list-format.sh    |  75 ++++++++++++++++++-\n> >  2 files changed, 242 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\n> > index 2a6278b..6791e0d 100755\n> > --- a/t/t4205-log-pretty-formats.sh\n> > +++ b/t/t4205-log-pretty-formats.sh\n> > @@ -153,6 +153,19 @@ EOF\n> >  \ttest_cmp expected actual\n> >  '\n> >  \n> > +test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '\n> > +\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(40)%s\" >actual &&\n> > +\t# complete the incomplete line at the end\n> > +\techo >>actual &&\n> \n> Would it change the meaning of the test if you used tformat: instead\n> of format: (or --format=\"%<(40)%s\")?  If it doesn't, it would make\n> it unnecessary to append an extra LF and explain why you do so.\nWell, actually, I just copied previous tests and added\ni18n.logOutputEncoding.\n\nBut as I can see in the code - no, tformat will not change the meaning.\nso, may be there is a reason to change that (initial) tests from format\nto tformat first? And then add mine new.\n> \n> > +\tqz_to_tab_space <<EOF | iconv -f utf-8 -t iso8859-1 >expected &&\n> \n> It is minor but many existing uses of iconv in our tests spell these\n> as UTF-8 and ISO8859-1 in uppercase.  I vaguely recall there was a\n> portability concern to favor the ones that are used in existing\n> tests, but probably it no longer matters (I see you added the\n> lowercase one with de6029a2 mid last year), so I am fine if these\n> stay lowercase.\nI've grep'ed for lowercase iso8859-1 in test, and found almost all of\nthem is code added by me.\nGrep for uppercase gives more results. I can refactor that first for\nuniformity.\n> \n> > +\tgit -c i18n.logOutputEncoding=iso8859-1 log --pretty=\"format:%<(1)%s\" >actual &&\n> > +\t# complete the incomplete line at the end\n> > +\techo >>actual &&\n> \n> Likewise for all the other \"--pretty=format:\" followed by an echo.\nthe same copy-paste-modify.\n\n> \n> Thanks.\n\n-- \nAlexey Shumkin\n"},{"id":"242165","messageId":"cover.1400513063.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"xmqqfvk9a797.fsf@gitster.dls.corp.google.com","subject":"[PATCH v3 0/5] Reroll patches. Pretty print truncate does not work","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-19T15:28:15Z","receivedAt":"2014-05-19T15:28:15Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"This patch series differs from the previous (v2) version in the following:\nt4205 refactored: hardcoded SHA-1 digests replaced with variabled\nTested encoding `iso8859-1` replaced with variable (and uppercased to be in line\n  in other tests)\nUsage of `format` + `echo` replaced with `tformat`\n\nbrian m. carlson <sandals@crustytoothpaste.net> CCed as he committed 5e1361c\n(log: properly handle decorations with chained tags, 2013-12-17)\n\nAlexey Shumkin (5):\n  t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n  t4041, t4205, t6006, t7102: Don't hardcode tested encoding value\n  t4205 (log-pretty-format): Use `tformat` rather than `format`\n  t4205, t6006: Add failing tests for the case when\n    i18n.logOutputEncoding is set\n  pretty.c: format string with truncate respects logOutputEncoding\n\n pretty.c                         |   7 +-\n t/t4041-diff-submodule-option.sh |   7 +-\n t/t4205-log-pretty-formats.sh    | 217 ++++++++++++++++++++++++++++++---------\n t/t6006-rev-list-format.sh       | 110 ++++++++++++++++----\n t/t7102-reset.sh                 |  13 ++-\n 5 files changed, 282 insertions(+), 72 deletions(-)\n\n-- \n1.9.2-15\n"},{"id":"242166","messageId":"69a0e0d286e3c2999e47e9591a91901baaa52327.1400513063.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400513063.git.Alex.Crezoff@gmail.com","subject":"[PATCH v3 1/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-19T15:28:16Z","receivedAt":"2014-05-19T15:28:16Z","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\nThat was introduced in a742f2a (t4205 (log-pretty-formats): don't\nhardcode SHA-1 in expected outputs, 2013-06-26) but unfortunately was\nnot followed in 5e1361c (log: properly handle decorations with chained\ntags, 2013-12-17)\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 2a6278b..f9f33ae 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -296,6 +296,10 @@ EOF\n \ttest_cmp expected actual\n '\n \n+# save HEAD's SHA-1 digest (with no abbreviations) to use it below\n+# as far as the next test amends HEAD\n+old_head1=$(git rev-parse --verify HEAD~0)\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@@ -310,6 +314,10 @@ EOF\n \ttest_cmp expected actual\n '\n \n+# get new digests (with no abbreviations)\n+head1=$(git rev-parse --verify HEAD~0) &&\n+head2=$(git rev-parse --verify HEAD~1) &&\n+\n test_expect_success 'log decoration properly follows tag chain' '\n \tgit tag -a tag1 -m tag1 &&\n \tgit tag -a tag2 -m tag2 tag1 &&\n@@ -317,9 +325,9 @@ test_expect_success 'log decoration properly follows tag chain' '\n \tgit commit --amend -m shorter &&\n \tgit log --no-walk --tags --pretty=\"%H %d\" --decorate=full >actual &&\n \tcat <<EOF >expected &&\n-6a908c10688b2503073c39c9ba26322c73902bb5  (tag: refs/tags/tag2)\n-9f716384d92283fb915a4eee5073f030638e05f9  (tag: refs/tags/message-one)\n-b87e4cccdb77336ea79d89224737be7ea8e95367  (tag: refs/tags/message-two)\n+$head1  (tag: refs/tags/tag2)\n+$head2  (tag: refs/tags/message-one)\n+$old_head1  (tag: refs/tags/message-two)\n EOF\n \tsort actual >actual1 &&\n \ttest_cmp expected actual1\n-- \n1.9.2-15\n"},{"id":"242167","messageId":"b7914b89c94560d61e2cd3369d6e1402710457ee.1400513063.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400513063.git.Alex.Crezoff@gmail.com","subject":"[PATCH v3 2/5] t4041, t4205, t6006, t7102: Don't hardcode tested encoding value","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-19T15:28:17Z","receivedAt":"2014-05-19T15:28:17Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The tested encoding is always available in a variable. Use it instead of\nhardcoding. Also, to be in line with other tests use ISO8859-1\n(uppercase) rather then iso8895-1.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |  7 +++++--\n t/t4205-log-pretty-formats.sh    | 11 +++++++----\n t/t6006-rev-list-format.sh       | 35 +++++++++++++++++++----------------\n t/t7102-reset.sh                 | 13 ++++++++-----\n 4 files changed, 39 insertions(+), 27 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 1751c83..463d63b 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -11,6 +11,9 @@ This test tries to verify the sanity of the --submodule option of git diff.\n \n . ./test-lib.sh\n \n+# Tested non-UTF-8 encoding\n+test_encoding=\"ISO8859-1\"\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@@ -23,8 +26,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 iso8859-1) &&\n-\t\t\tgit -c 'i18n.commitEncoding=iso8859-1' commit -m \"$msg_added_iso88591\"\n+\t\t\tmsg_added_iso88591=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t $test_encoding) &&\n+\t\t\tgit -c \"i18n.commitEncoding=$test_encoding\" 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 f9f33ae..f5ea3f8 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -7,6 +7,9 @@\n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+# Tested non-UTF-8 encoding\n+test_encoding=\"ISO8859-1\"\n+\n sample_utf8_part=$(printf \"f\\303\\244ng\")\n \n commit_msg () {\n@@ -27,8 +30,8 @@ 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+\tgit config i18n.commitEncoding $test_encoding &&\n+\tgit commit -m \"$(commit_msg $test_encoding)\" &&\n \tgit add bar &&\n \ttest_tick &&\n \tgit commit -m \"add bar\" &&\n@@ -56,8 +59,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 (iso8859-1 encoding)' '\n-\tgit config i18n.logOutputEncoding iso8859-1 &&\n+test_expect_success 'alias user-defined tformat with %s (ISO8859-1 encoding)' '\n+\tgit config i18n.logOutputEncoding $test_encoding &&\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 9874403..9e4ba62 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -9,19 +9,22 @@ test_description='git rev-list --pretty=format test'\n . \"$TEST_DIRECTORY\"/lib-terminal.sh\n \n test_tick\n+# Tested non-UTF-8 encoding\n+test_encoding=\"ISO8859-1\"\n+\n # String \"added\" in German\n # (translated with Google Translate),\n # encoded in UTF-8, 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+added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t $test_encoding)\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+changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t $test_encoding)\n \n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n-\tgit config i18n.commitEncoding iso8859-1 &&\n+\tgit config i18n.commitEncoding $test_encoding &&\n \tgit commit -m \"$added_iso88591\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_short=$(git rev-parse --verify --short $head1) &&\n@@ -124,9 +127,9 @@ EOF\n \n test_format encoding %e <<EOF\n commit $head2\n-iso8859-1\n+$test_encoding\n commit $head1\n-iso8859-1\n+$test_encoding\n EOF\n \n test_format subject %s <<EOF\n@@ -206,16 +209,16 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '\n \t)\n '\n \n-iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF\n+iconv -f utf-8 -t $test_encoding > 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 $test_encoding. We should therefore\n+include an ISO8859 character: ¡bueno!\n EOF\n \n test_expect_success 'setup complex body' '\n-\tgit config i18n.commitencoding iso8859-1 &&\n+\tgit config i18n.commitencoding $test_encoding &&\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@@ -223,11 +226,11 @@ test_expect_success 'setup complex body' '\n \n test_format complex-encoding %e <<EOF\n commit $head3\n-iso8859-1\n+$test_encoding\n commit $head2\n-iso8859-1\n+$test_encoding\n commit $head1\n-iso8859-1\n+$test_encoding\n EOF\n \n test_format complex-subject %s <<EOF\n@@ -243,16 +246,16 @@ test_expect_success 'prepare expected messages (for test %b)' '\n \tcat <<-EOF >expected.utf-8 &&\n \tcommit $head3\n \tThis commit message is much longer than the others,\n-\tand it will be encoded in iso8859-1. We should therefore\n-\tinclude an iso8859 character: ¡bueno!\n+\tand it will be encoded in $test_encoding. We should therefore\n+\tinclude an ISO8859 character: ¡bueno!\n \n \tcommit $head2\n \tcommit $head1\n \tEOF\n-\ticonv -f utf-8 -t iso8859-1 expected.utf-8 >expected.iso8859-1\n+\ticonv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1\n '\n \n-test_format complex-body %b <expected.iso8859-1\n+test_format complex-body %b <expected.ISO8859-1\n \n # Git uses i18n.commitEncoding if no i18n.logOutputEncoding set\n # so unset i18n.commitEncoding to test encoding conversion\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex ee117e2..8a56756 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -22,6 +22,9 @@ commit_msg () {\n \tfi\n }\n \n+# Tested non-UTF-8 encoding\n+test_encoding=\"ISO8859-1\"\n+\n test_expect_success 'creating initial files and commits' '\n \ttest_tick &&\n \techo \"1st file\" >first &&\n@@ -41,7 +44,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=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n+\tgit -c \"i18n.commitEncoding=$test_encoding\" commit -a -m \"$(commit_msg $test_encoding)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -64,10 +67,10 @@ test_expect_success 'reset --hard message' '\n \ttest_cmp .expected .actual\n '\n \n-test_expect_success 'reset --hard message (iso8859-1 logoutputencoding)' '\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+\tgit -c \"i18n.logOutputEncoding=$test_encoding\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg $test_encoding) > .expected &&\n \ttest_cmp .expected .actual\n '\n \n@@ -331,7 +334,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=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n+\tgit -c \"i18n.commitEncoding=$test_encoding\" commit -a -m \"$(commit_msg $test_encoding)\" &&\n \tcheck_changes $head5\n '\n \n-- \n1.9.2-15\n"},{"id":"242168","messageId":"86529d511be50be2ba1d9cc33575a253a52d1bae.1400513063.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400513063.git.Alex.Crezoff@gmail.com","subject":"[PATCH v3 3/5] t4205 (log-pretty-format): Use `tformat` rather than `format`","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-19T15:28:18Z","receivedAt":"2014-05-19T15:28:18Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Use `tformat` to avoid using of `echo` to complete end of line.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 52 +++++++++++--------------------------------\n 1 file changed, 13 insertions(+), 39 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex f5ea3f8..c03a65e 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -144,9 +144,7 @@ test_expect_success 'setup more commits' '\n '\n \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+\tgit log --pretty=\"tformat:%<(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n message two                            Z\n message one                            Z\n@@ -157,9 +155,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%h %<|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n $head1 message two                    Z\n $head2 message one                    Z\n@@ -170,9 +166,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%<(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n message two\n message one\n@@ -183,9 +177,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%<(10,trunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n message ..\n message ..\n@@ -196,9 +188,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%<(10,ltrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n ..sage two\n ..sage one\n@@ -209,9 +199,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%<(10,mtrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n mess.. two\n mess.. one\n@@ -222,9 +210,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%>(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n Z                            message two\n Z                            message one\n@@ -235,9 +221,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%h %>|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n $head1                      message two\n $head2                      message one\n@@ -248,9 +232,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%>(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n message two\n message one\n@@ -261,9 +243,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%><(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n Z             message two              Z\n Z             message one              Z\n@@ -274,9 +254,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%h %><|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n $head1           message two          Z\n $head2           message one          Z\n@@ -287,9 +265,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%><(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n message two\n message one\n@@ -305,9 +281,7 @@ old_head1=$(git rev-parse --verify HEAD~0)\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-\t# complete the incomplete line at the end\n-\techo >>actual &&\n+\tgit log --pretty=\"tformat:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \tcat <<EOF >expected &&\n short long  long long\n message ..   A U Thor\n-- \n1.9.2-15\n"},{"id":"242170","messageId":"1ab6aabaf34ecbb0fa6ded22d48e9f939a9d2176.1400513063.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400513063.git.Alex.Crezoff@gmail.com","subject":"[PATCH v3 4/5] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-19T15:28:19Z","receivedAt":"2014-05-19T15:28:19Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nThere were no breakages as far as were no tests for the case\nwhen both a commit message and logOutputEncoding are not UTF-8.\n\nAdd failing tests for that which will be fixed in the next patch.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nReviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 140 ++++++++++++++++++++++++++++++++++++++++++\n t/t6006-rev-list-format.sh    |  75 +++++++++++++++++++++-\n 2 files changed, 213 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex c03a65e..74babce 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -154,6 +154,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'left alignment formatting at the nth column' '\n \tgit log --pretty=\"tformat:%h %<|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -165,6 +176,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%h %<|(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'left alignment formatting with no padding' '\n \tgit log --pretty=\"tformat:%<(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n@@ -176,6 +198,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(1)%s\" >actual &&\n+\tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'left alignment formatting with trunc' '\n \tgit log --pretty=\"tformat:%<(10,trunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -187,6 +220,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,trunc)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+message ..\n+message ..\n+add bar  Z\n+initial...\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'left alignment formatting with ltrunc' '\n \tgit log --pretty=\"tformat:%<(10,ltrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -198,6 +242,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,ltrunc)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+..sage two\n+..sage one\n+add bar  Z\n+..${sample_utf8_part}lich\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'left alignment formatting with mtrunc' '\n \tgit log --pretty=\"tformat:%<(10,mtrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -209,6 +264,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,mtrunc)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+mess.. two\n+mess.. one\n+add bar  Z\n+init..lich\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'right alignment formatting' '\n \tgit log --pretty=\"tformat:%>(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -220,6 +286,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%>(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'right alignment formatting at the nth column' '\n \tgit log --pretty=\"tformat:%h %>|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -231,6 +308,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%h %>|(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'right alignment formatting with no padding' '\n \tgit log --pretty=\"tformat:%>(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n@@ -242,6 +330,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%>(1)%s\" >actual &&\n+\tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'center alignment formatting' '\n \tgit log --pretty=\"tformat:%><(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -253,6 +352,16 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%><(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'center alignment formatting at the nth column' '\n \tgit log --pretty=\"tformat:%h %><|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -264,6 +373,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%h %><|(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'center alignment formatting with no padding' '\n \tgit log --pretty=\"tformat:%><(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n@@ -278,6 +398,16 @@ EOF\n # save HEAD's SHA-1 digest (with no abbreviations) to use it below\n # as far as the next test amends HEAD\n old_head1=$(git rev-parse --verify HEAD~0)\n+test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%><(1)%s\" >actual &&\n+\tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\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@@ -290,6 +420,16 @@ initial...   A U Thor\n EOF\n \ttest_cmp expected actual\n '\n+test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n+\tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+short long  long long\n+message ..   A U Thor\n+add bar      A U Thor\n+initial...   A U Thor\n+EOF\n+\ttest_cmp expected actual\n+'\n \n # get new digests (with no abbreviations)\n head1=$(git rev-parse --verify HEAD~0) &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 9e4ba62..a932f34 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -15,12 +15,22 @@ test_encoding=\"ISO8859-1\"\n # String \"added\" in German\n # (translated with Google Translate),\n # encoded in UTF-8, used as a commit log message below.\n-added=$(printf \"added (hinzugef\\303\\274gt) foo\")\n+added_utf8_part=$(printf \"\\303\\274\")\n+added_utf8_part_iso88591=$(echo \"$added_utf8_part\" | iconv -f utf-8 -t $test_encoding)\n+added=$(printf \"added (hinzugef${added_utf8_part}gt) foo\")\n added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t $test_encoding)\n # same but \"changed\"\n-changed=$(printf \"changed (ge\\303\\244ndert) foo\")\n+changed_utf8_part=$(printf \"\\303\\244\")\n+changed_utf8_part_iso88591=$(echo \"$changed_utf8_part\" | iconv -f utf-8 -t $test_encoding)\n+changed=$(printf \"changed (ge${changed_utf8_part}ndert) foo\")\n changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t $test_encoding)\n \n+# Count of char to truncate\n+# Number is chosen so, that non-ACSII characters\n+# (see $added_utf8_part and $changed_utf8_part)\n+# fall into truncated parts of appropriate words both from left and right\n+truncate_count=20\n+\n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n@@ -139,6 +149,13 @@ commit $head1\n $added\n EOF\n \n+test_format subject-truncated %<($truncate_count,trunc)%s <<EOF\n+commit $head2\n+changed (ge${changed_utf8_part}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part}gt..\n+EOF\n+\n test_format body %b <<EOF\n commit $head2\n commit $head1\n@@ -242,6 +259,33 @@ commit $head1\n $added_iso88591\n EOF\n \n+test_format complex-subject-trunc %<($truncate_count,trunc)%s failure <<EOF\n+commit $head3\n+Test printing of c..\n+commit $head2\n+changed (ge${changed_utf8_part_iso88591}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part_iso88591}gt..\n+EOF\n+\n+test_format complex-subject-mtrunc %<($truncate_count,mtrunc)%s failure <<EOF\n+commit $head3\n+Test prin..ex bodies\n+commit $head2\n+changed (..dert) foo\n+commit $head1\n+added (hi..f${added_utf8_part_iso88591}gt) foo\n+EOF\n+\n+test_format complex-subject-ltrunc %<($truncate_count,ltrunc)%s failure <<EOF\n+commit $head3\n+.. of complex bodies\n+commit $head2\n+..ged (ge${changed_utf8_part_iso88591}ndert) foo\n+commit $head1\n+.. (hinzugef${added_utf8_part_iso88591}gt) foo\n+EOF\n+\n test_expect_success 'prepare expected messages (for test %b)' '\n \tcat <<-EOF >expected.utf-8 &&\n \tcommit $head3\n@@ -270,6 +314,33 @@ commit $head1\n $added\n EOF\n \n+test_format complex-subject-commitencoding-unset-trunc %<($truncate_count,trunc)%s <<EOF\n+commit $head3\n+Test printing of c..\n+commit $head2\n+changed (ge${changed_utf8_part}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part}gt..\n+EOF\n+\n+test_format complex-subject-commitencoding-unset-mtrunc %<($truncate_count,mtrunc)%s <<EOF\n+commit $head3\n+Test prin..ex bodies\n+commit $head2\n+changed (..dert) foo\n+commit $head1\n+added (hi..f${added_utf8_part}gt) foo\n+EOF\n+\n+test_format complex-subject-commitencoding-unset-ltrunc %<($truncate_count,ltrunc)%s <<EOF\n+commit $head3\n+.. of complex bodies\n+commit $head2\n+..ged (ge${changed_utf8_part}ndert) foo\n+commit $head1\n+.. (hinzugef${added_utf8_part}gt) foo\n+EOF\n+\n test_format complex-body-commitencoding-unset %b <expected.utf-8\n \n test_expect_success '%x00 shows NUL' '\n-- \n1.9.2-15\n"},{"id":"242169","messageId":"8dbe3506315942709627102c133d555139ac68af.1400513063.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400513063.git.Alex.Crezoff@gmail.com","subject":"[PATCH v3 5/5] pretty.c: format string with truncate respects logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-19T15:28:20Z","receivedAt":"2014-05-19T15:28:20Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nIn 7e77df3 (pretty: two phase conversion for non utf-8 commits, 2013-04-19)\n'format_commit_item' function assumes commit message to be in UTF-8.\nAnd that was so until ecaee80 (pretty: --format output should honor\nlogOutputEncoding, 2013-06-26) where conversion to logOutputEncoding was\nadded before calling 'format_commit_message'.\n\nCorrect this by converting a commit message to UTF-8 first (as it\nassumed in 7e77df3 (pretty: two phase conversion for non utf-8 commits,\n2013-04-19)). Only after that convert a commit message to an actual\nlogOutputEncoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nReviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n pretty.c                      | 7 ++++++-\n t/t4205-log-pretty-formats.sh | 8 ++++----\n t/t6006-rev-list-format.sh    | 6 +++---\n 3 files changed, 13 insertions(+), 8 deletions(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 6e266dd..25e8825 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1507,13 +1507,18 @@ void format_commit_message(const struct commit *commit,\n \tcontext.commit = commit;\n \tcontext.pretty_ctx = pretty_ctx;\n \tcontext.wrap_start = sb->len;\n+\t/*\n+\t * convert a commit message to UTF-8 first\n+\t * as far as 'format_commit_item' assumes it in UTF-8\n+\t */\n \tcontext.message = logmsg_reencode(commit,\n \t\t\t\t\t  &context.commit_encoding,\n-\t\t\t\t\t  output_enc);\n+\t\t\t\t\t  utf8);\n \n \tstrbuf_expand(sb, format, format_commit_item, &context);\n \trewrap_message_tail(sb, &context, 0, 0, 0);\n \n+\t/* then convert a commit message to an actual output encoding */\n \tif (output_enc) {\n \t\tif (same_encoding(utf8, output_enc))\n \t\t\toutput_enc = NULL;\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 74babce..c84ec9a 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -220,7 +220,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,trunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n message ..\n@@ -242,7 +242,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,ltrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n ..sage two\n@@ -264,7 +264,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,mtrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n mess.. two\n@@ -420,7 +420,7 @@ initial...   A U Thor\n EOF\n \ttest_cmp expected actual\n '\n-test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n+test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n short long  long long\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex a932f34..c6e9a73 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -259,7 +259,7 @@ commit $head1\n $added_iso88591\n EOF\n \n-test_format complex-subject-trunc %<($truncate_count,trunc)%s failure <<EOF\n+test_format complex-subject-trunc %<($truncate_count,trunc)%s <<EOF\n commit $head3\n Test printing of c..\n commit $head2\n@@ -268,7 +268,7 @@ commit $head1\n added (hinzugef${added_utf8_part_iso88591}gt..\n EOF\n \n-test_format complex-subject-mtrunc %<($truncate_count,mtrunc)%s failure <<EOF\n+test_format complex-subject-mtrunc %<($truncate_count,mtrunc)%s <<EOF\n commit $head3\n Test prin..ex bodies\n commit $head2\n@@ -277,7 +277,7 @@ commit $head1\n added (hi..f${added_utf8_part_iso88591}gt) foo\n EOF\n \n-test_format complex-subject-ltrunc %<($truncate_count,ltrunc)%s failure <<EOF\n+test_format complex-subject-ltrunc %<($truncate_count,ltrunc)%s <<EOF\n commit $head3\n .. of complex bodies\n commit $head2\n-- \n1.9.2-15\n"},{"id":"242225","messageId":"20140520014931.GF180798@vauxhall.crustytoothpaste.net","threadId":"36676","inReplyTo":"b7914b89c94560d61e2cd3369d6e1402710457ee.1400513063.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v3 2/5] t4041, t4205, t6006, t7102: Don't hardcode tested encoding value","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2014-05-20T01:49:31Z","receivedAt":"2014-05-20T01:49:31Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Mon, May 19, 2014 at 07:28:17PM +0400, Alexey Shumkin wrote:\n> The tested encoding is always available in a variable. Use it instead of\n> hardcoding. Also, to be in line with other tests use ISO8859-1\n> (uppercase) rather then iso8895-1.\n\nYou wrote \"iso8895\" when I think you meant \"iso8859\".\n\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\n+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n"},{"id":"242228","messageId":"20140520064103.GA18358@ashu.dyn1.rarus.ru","threadId":"36676","inReplyTo":"20140520014931.GF180798@vauxhall.crustytoothpaste.net","subject":"Re: [PATCH v3 2/5] t4041, t4205, t6006, t7102: Don't hardcode tested encoding value","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-20T06:41:03Z","receivedAt":"2014-05-20T06:41:03Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"On Tue, May 20, 2014 at 01:49:31AM +0000, brian m. carlson wrote:\n> On Mon, May 19, 2014 at 07:28:17PM +0400, Alexey Shumkin wrote:\n> > The tested encoding is always available in a variable. Use it instead of\n> > hardcoding. Also, to be in line with other tests use ISO8859-1\n> > (uppercase) rather then iso8895-1.\n> \n> You wrote \"iso8895\" when I think you meant \"iso8859\".\nOops!\nYes, you're right, I've meant iso8859.\n> \n> -- \n> brian m. carlson / brian with sandals: Houston, Texas, US\n> +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only\n> OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187\n\n\n\n-- \nAlexey Shumkin\nE-mail: Alex.Crezoff@gmail.com\nICQ: 118001447\nJabber (GoogleTalk): Alex.Crezoff@gmail.com\nSkype: crezoff\n"},{"id":"242375","messageId":"cover.1400678003.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400513063.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 0/5] Reroll patches. Pretty print truncate does not work","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-21T13:20:02Z","receivedAt":"2014-05-21T13:20:02Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"This version (v4) differs from the previuos (v3):\n1. Fixed typo ISO8895-1 (vs ISO8859-1)\n2. Fixed t4205 test: tested format strings are double-quoted\n\nAlexey Shumkin (5):\n  t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs\n  t4041, t4205, t6006, t7102: Don't hardcode tested encoding value\n  t4205 (log-pretty-format): Use `tformat` rather than `format`\n  t4205, t6006: Add failing tests for the case when\n    i18n.logOutputEncoding is set\n  pretty.c: format string with truncate respects logOutputEncoding\n\n pretty.c                         |   7 +-\n t/t4041-diff-submodule-option.sh |   7 +-\n t/t4205-log-pretty-formats.sh    | 217 ++++++++++++++++++++++++++++++---------\n t/t6006-rev-list-format.sh       | 110 ++++++++++++++++----\n t/t7102-reset.sh                 |  13 ++-\n 5 files changed, 282 insertions(+), 72 deletions(-)\n\n-- \n1.9.2-15\n"},{"id":"242376","messageId":"69a0e0d286e3c2999e47e9591a91901baaa52327.1400678003.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400678003.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 1/5] t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-21T13:20:03Z","receivedAt":"2014-05-21T13:20:03Z","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\nThat was introduced in a742f2a (t4205 (log-pretty-formats): don't\nhardcode SHA-1 in expected outputs, 2013-06-26) but unfortunately was\nnot followed in 5e1361c (log: properly handle decorations with chained\ntags, 2013-12-17)\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 2a6278b..f9f33ae 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -296,6 +296,10 @@ EOF\n \ttest_cmp expected actual\n '\n \n+# save HEAD's SHA-1 digest (with no abbreviations) to use it below\n+# as far as the next test amends HEAD\n+old_head1=$(git rev-parse --verify HEAD~0)\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@@ -310,6 +314,10 @@ EOF\n \ttest_cmp expected actual\n '\n \n+# get new digests (with no abbreviations)\n+head1=$(git rev-parse --verify HEAD~0) &&\n+head2=$(git rev-parse --verify HEAD~1) &&\n+\n test_expect_success 'log decoration properly follows tag chain' '\n \tgit tag -a tag1 -m tag1 &&\n \tgit tag -a tag2 -m tag2 tag1 &&\n@@ -317,9 +325,9 @@ test_expect_success 'log decoration properly follows tag chain' '\n \tgit commit --amend -m shorter &&\n \tgit log --no-walk --tags --pretty=\"%H %d\" --decorate=full >actual &&\n \tcat <<EOF >expected &&\n-6a908c10688b2503073c39c9ba26322c73902bb5  (tag: refs/tags/tag2)\n-9f716384d92283fb915a4eee5073f030638e05f9  (tag: refs/tags/message-one)\n-b87e4cccdb77336ea79d89224737be7ea8e95367  (tag: refs/tags/message-two)\n+$head1  (tag: refs/tags/tag2)\n+$head2  (tag: refs/tags/message-one)\n+$old_head1  (tag: refs/tags/message-two)\n EOF\n \tsort actual >actual1 &&\n \ttest_cmp expected actual1\n-- \n1.9.2-15\n"},{"id":"242377","messageId":"54dcfd93d1f81f106bc106bf0ae60ab5b5a6bab4.1400678003.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400678003.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 2/5] t4041, t4205, t6006, t7102: Don't hardcode tested encoding value","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-21T13:20:04Z","receivedAt":"2014-05-21T13:20:04Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"The tested encoding is always available in a variable. Use it instead of\nhardcoding. Also, to be in line with other tests use ISO8859-1\n(uppercase) rather then iso8859-1.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4041-diff-submodule-option.sh |  7 +++++--\n t/t4205-log-pretty-formats.sh    | 11 +++++++----\n t/t6006-rev-list-format.sh       | 35 +++++++++++++++++++----------------\n t/t7102-reset.sh                 | 13 ++++++++-----\n 4 files changed, 39 insertions(+), 27 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 1751c83..463d63b 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -11,6 +11,9 @@ This test tries to verify the sanity of the --submodule option of git diff.\n \n . ./test-lib.sh\n \n+# Tested non-UTF-8 encoding\n+test_encoding=\"ISO8859-1\"\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@@ -23,8 +26,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 iso8859-1) &&\n-\t\t\tgit -c 'i18n.commitEncoding=iso8859-1' commit -m \"$msg_added_iso88591\"\n+\t\t\tmsg_added_iso88591=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t $test_encoding) &&\n+\t\t\tgit -c \"i18n.commitEncoding=$test_encoding\" 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 f9f33ae..f5ea3f8 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -7,6 +7,9 @@\n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+# Tested non-UTF-8 encoding\n+test_encoding=\"ISO8859-1\"\n+\n sample_utf8_part=$(printf \"f\\303\\244ng\")\n \n commit_msg () {\n@@ -27,8 +30,8 @@ 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+\tgit config i18n.commitEncoding $test_encoding &&\n+\tgit commit -m \"$(commit_msg $test_encoding)\" &&\n \tgit add bar &&\n \ttest_tick &&\n \tgit commit -m \"add bar\" &&\n@@ -56,8 +59,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 (iso8859-1 encoding)' '\n-\tgit config i18n.logOutputEncoding iso8859-1 &&\n+test_expect_success 'alias user-defined tformat with %s (ISO8859-1 encoding)' '\n+\tgit config i18n.logOutputEncoding $test_encoding &&\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 9874403..9e4ba62 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -9,19 +9,22 @@ test_description='git rev-list --pretty=format test'\n . \"$TEST_DIRECTORY\"/lib-terminal.sh\n \n test_tick\n+# Tested non-UTF-8 encoding\n+test_encoding=\"ISO8859-1\"\n+\n # String \"added\" in German\n # (translated with Google Translate),\n # encoded in UTF-8, 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+added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t $test_encoding)\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+changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t $test_encoding)\n \n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n-\tgit config i18n.commitEncoding iso8859-1 &&\n+\tgit config i18n.commitEncoding $test_encoding &&\n \tgit commit -m \"$added_iso88591\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_short=$(git rev-parse --verify --short $head1) &&\n@@ -124,9 +127,9 @@ EOF\n \n test_format encoding %e <<EOF\n commit $head2\n-iso8859-1\n+$test_encoding\n commit $head1\n-iso8859-1\n+$test_encoding\n EOF\n \n test_format subject %s <<EOF\n@@ -206,16 +209,16 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '\n \t)\n '\n \n-iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF\n+iconv -f utf-8 -t $test_encoding > 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 $test_encoding. We should therefore\n+include an ISO8859 character: ¡bueno!\n EOF\n \n test_expect_success 'setup complex body' '\n-\tgit config i18n.commitencoding iso8859-1 &&\n+\tgit config i18n.commitencoding $test_encoding &&\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@@ -223,11 +226,11 @@ test_expect_success 'setup complex body' '\n \n test_format complex-encoding %e <<EOF\n commit $head3\n-iso8859-1\n+$test_encoding\n commit $head2\n-iso8859-1\n+$test_encoding\n commit $head1\n-iso8859-1\n+$test_encoding\n EOF\n \n test_format complex-subject %s <<EOF\n@@ -243,16 +246,16 @@ test_expect_success 'prepare expected messages (for test %b)' '\n \tcat <<-EOF >expected.utf-8 &&\n \tcommit $head3\n \tThis commit message is much longer than the others,\n-\tand it will be encoded in iso8859-1. We should therefore\n-\tinclude an iso8859 character: ¡bueno!\n+\tand it will be encoded in $test_encoding. We should therefore\n+\tinclude an ISO8859 character: ¡bueno!\n \n \tcommit $head2\n \tcommit $head1\n \tEOF\n-\ticonv -f utf-8 -t iso8859-1 expected.utf-8 >expected.iso8859-1\n+\ticonv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1\n '\n \n-test_format complex-body %b <expected.iso8859-1\n+test_format complex-body %b <expected.ISO8859-1\n \n # Git uses i18n.commitEncoding if no i18n.logOutputEncoding set\n # so unset i18n.commitEncoding to test encoding conversion\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex ee117e2..8a56756 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -22,6 +22,9 @@ commit_msg () {\n \tfi\n }\n \n+# Tested non-UTF-8 encoding\n+test_encoding=\"ISO8859-1\"\n+\n test_expect_success 'creating initial files and commits' '\n \ttest_tick &&\n \techo \"1st file\" >first &&\n@@ -41,7 +44,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=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n+\tgit -c \"i18n.commitEncoding=$test_encoding\" commit -a -m \"$(commit_msg $test_encoding)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -64,10 +67,10 @@ test_expect_success 'reset --hard message' '\n \ttest_cmp .expected .actual\n '\n \n-test_expect_success 'reset --hard message (iso8859-1 logoutputencoding)' '\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+\tgit -c \"i18n.logOutputEncoding=$test_encoding\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg $test_encoding) > .expected &&\n \ttest_cmp .expected .actual\n '\n \n@@ -331,7 +334,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=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n+\tgit -c \"i18n.commitEncoding=$test_encoding\" commit -a -m \"$(commit_msg $test_encoding)\" &&\n \tcheck_changes $head5\n '\n \n-- \n1.9.2-15\n"},{"id":"242378","messageId":"257a808af3a14e999f99823792b37f12190209f3.1400678003.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400678003.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 3/5] t4205 (log-pretty-format): Use `tformat` rather than `format`","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-21T13:20:05Z","receivedAt":"2014-05-21T13:20:05Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Use `tformat` to avoid using of `echo` to complete end of line.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n---\n t/t4205-log-pretty-formats.sh | 52 +++++++++++--------------------------------\n 1 file changed, 13 insertions(+), 39 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex f5ea3f8..c03a65e 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -144,9 +144,7 @@ test_expect_success 'setup more commits' '\n '\n \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+\tgit log --pretty=\"tformat:%<(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n message two                            Z\n message one                            Z\n@@ -157,9 +155,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%h %<|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n $head1 message two                    Z\n $head2 message one                    Z\n@@ -170,9 +166,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%<(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n message two\n message one\n@@ -183,9 +177,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%<(10,trunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n message ..\n message ..\n@@ -196,9 +188,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%<(10,ltrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n ..sage two\n ..sage one\n@@ -209,9 +199,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%<(10,mtrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n mess.. two\n mess.. one\n@@ -222,9 +210,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%>(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n Z                            message two\n Z                            message one\n@@ -235,9 +221,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%h %>|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n $head1                      message two\n $head2                      message one\n@@ -248,9 +232,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%>(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n message two\n message one\n@@ -261,9 +243,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%><(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n Z             message two              Z\n Z             message one              Z\n@@ -274,9 +254,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%h %><|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n $head1           message two          Z\n $head2           message one          Z\n@@ -287,9 +265,7 @@ EOF\n '\n \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+\tgit log --pretty=\"tformat:%><(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n message two\n message one\n@@ -305,9 +281,7 @@ old_head1=$(git rev-parse --verify HEAD~0)\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-\t# complete the incomplete line at the end\n-\techo >>actual &&\n+\tgit log --pretty=\"tformat:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \tcat <<EOF >expected &&\n short long  long long\n message ..   A U Thor\n-- \n1.9.2-15\n"},{"id":"242379","messageId":"12b22fd98d687b0484d7d5e5f122d770ca56908d.1400678003.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400678003.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 4/5] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-21T13:20:06Z","receivedAt":"2014-05-21T13:20:06Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nThere were no breakages as far as were no tests for the case\nwhen both a commit message and logOutputEncoding are not UTF-8.\n\nAdd failing tests for that which will be fixed in the next patch.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nReviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nReviewed-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n t/t4205-log-pretty-formats.sh | 140 ++++++++++++++++++++++++++++++++++++++++++\n t/t6006-rev-list-format.sh    |  75 +++++++++++++++++++++-\n 2 files changed, 213 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex c03a65e..74babce 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -154,6 +154,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'left alignment formatting at the nth column' '\n \tgit log --pretty=\"tformat:%h %<|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -165,6 +176,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%h %<|(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'left alignment formatting with no padding' '\n \tgit log --pretty=\"tformat:%<(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n@@ -176,6 +198,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(1)%s\" >actual &&\n+\tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'left alignment formatting with trunc' '\n \tgit log --pretty=\"tformat:%<(10,trunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -187,6 +220,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,trunc)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+message ..\n+message ..\n+add bar  Z\n+initial...\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'left alignment formatting with ltrunc' '\n \tgit log --pretty=\"tformat:%<(10,ltrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -198,6 +242,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,ltrunc)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+..sage two\n+..sage one\n+add bar  Z\n+..${sample_utf8_part}lich\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'left alignment formatting with mtrunc' '\n \tgit log --pretty=\"tformat:%<(10,mtrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -209,6 +264,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,mtrunc)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+mess.. two\n+mess.. one\n+add bar  Z\n+init..lich\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'right alignment formatting' '\n \tgit log --pretty=\"tformat:%>(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -220,6 +286,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%>(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'right alignment formatting at the nth column' '\n \tgit log --pretty=\"tformat:%h %>|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -231,6 +308,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%h %>|(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'right alignment formatting with no padding' '\n \tgit log --pretty=\"tformat:%>(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n@@ -242,6 +330,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%>(1)%s\" >actual &&\n+\tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'center alignment formatting' '\n \tgit log --pretty=\"tformat:%><(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -253,6 +352,16 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%><(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'center alignment formatting at the nth column' '\n \tgit log --pretty=\"tformat:%h %><|(40)%s\" >actual &&\n \tqz_to_tab_space <<EOF >expected &&\n@@ -264,6 +373,17 @@ EOF\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%h %><|(40)%s\" >actual &&\n+\tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >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 test_expect_success 'center alignment formatting with no padding' '\n \tgit log --pretty=\"tformat:%><(1)%s\" >actual &&\n \tcat <<EOF >expected &&\n@@ -278,6 +398,16 @@ EOF\n # save HEAD's SHA-1 digest (with no abbreviations) to use it below\n # as far as the next test amends HEAD\n old_head1=$(git rev-parse --verify HEAD~0)\n+test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%><(1)%s\" >actual &&\n+\tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+message two\n+message one\n+add bar\n+$(commit_msg)\n+EOF\n+\ttest_cmp expected actual\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@@ -290,6 +420,16 @@ initial...   A U Thor\n EOF\n \ttest_cmp expected actual\n '\n+test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n+\tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n+\tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n+short long  long long\n+message ..   A U Thor\n+add bar      A U Thor\n+initial...   A U Thor\n+EOF\n+\ttest_cmp expected actual\n+'\n \n # get new digests (with no abbreviations)\n head1=$(git rev-parse --verify HEAD~0) &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 9e4ba62..42bdefe 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -15,12 +15,22 @@ test_encoding=\"ISO8859-1\"\n # String \"added\" in German\n # (translated with Google Translate),\n # encoded in UTF-8, used as a commit log message below.\n-added=$(printf \"added (hinzugef\\303\\274gt) foo\")\n+added_utf8_part=$(printf \"\\303\\274\")\n+added_utf8_part_iso88591=$(echo \"$added_utf8_part\" | iconv -f utf-8 -t $test_encoding)\n+added=$(printf \"added (hinzugef${added_utf8_part}gt) foo\")\n added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t $test_encoding)\n # same but \"changed\"\n-changed=$(printf \"changed (ge\\303\\244ndert) foo\")\n+changed_utf8_part=$(printf \"\\303\\244\")\n+changed_utf8_part_iso88591=$(echo \"$changed_utf8_part\" | iconv -f utf-8 -t $test_encoding)\n+changed=$(printf \"changed (ge${changed_utf8_part}ndert) foo\")\n changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t $test_encoding)\n \n+# Count of char to truncate\n+# Number is chosen so, that non-ACSII characters\n+# (see $added_utf8_part and $changed_utf8_part)\n+# fall into truncated parts of appropriate words both from left and right\n+truncate_count=20\n+\n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n@@ -139,6 +149,13 @@ commit $head1\n $added\n EOF\n \n+test_format subject-truncated \"%<($truncate_count,trunc)%s\" <<EOF\n+commit $head2\n+changed (ge${changed_utf8_part}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part}gt..\n+EOF\n+\n test_format body %b <<EOF\n commit $head2\n commit $head1\n@@ -242,6 +259,33 @@ commit $head1\n $added_iso88591\n EOF\n \n+test_format complex-subject-trunc \"%<($truncate_count,trunc)%s\" failure <<EOF\n+commit $head3\n+Test printing of c..\n+commit $head2\n+changed (ge${changed_utf8_part_iso88591}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part_iso88591}gt..\n+EOF\n+\n+test_format complex-subject-mtrunc \"%<($truncate_count,mtrunc)%s\" failure <<EOF\n+commit $head3\n+Test prin..ex bodies\n+commit $head2\n+changed (..dert) foo\n+commit $head1\n+added (hi..f${added_utf8_part_iso88591}gt) foo\n+EOF\n+\n+test_format complex-subject-ltrunc \"%<($truncate_count,ltrunc)%s\" failure <<EOF\n+commit $head3\n+.. of complex bodies\n+commit $head2\n+..ged (ge${changed_utf8_part_iso88591}ndert) foo\n+commit $head1\n+.. (hinzugef${added_utf8_part_iso88591}gt) foo\n+EOF\n+\n test_expect_success 'prepare expected messages (for test %b)' '\n \tcat <<-EOF >expected.utf-8 &&\n \tcommit $head3\n@@ -270,6 +314,33 @@ commit $head1\n $added\n EOF\n \n+test_format complex-subject-commitencoding-unset-trunc \"%<($truncate_count,trunc)%s\" <<EOF\n+commit $head3\n+Test printing of c..\n+commit $head2\n+changed (ge${changed_utf8_part}ndert)..\n+commit $head1\n+added (hinzugef${added_utf8_part}gt..\n+EOF\n+\n+test_format complex-subject-commitencoding-unset-mtrunc \"%<($truncate_count,mtrunc)%s\" <<EOF\n+commit $head3\n+Test prin..ex bodies\n+commit $head2\n+changed (..dert) foo\n+commit $head1\n+added (hi..f${added_utf8_part}gt) foo\n+EOF\n+\n+test_format complex-subject-commitencoding-unset-ltrunc \"%<($truncate_count,ltrunc)%s\" <<EOF\n+commit $head3\n+.. of complex bodies\n+commit $head2\n+..ged (ge${changed_utf8_part}ndert) foo\n+commit $head1\n+.. (hinzugef${added_utf8_part}gt) foo\n+EOF\n+\n test_format complex-body-commitencoding-unset %b <expected.utf-8\n \n test_expect_success '%x00 shows NUL' '\n-- \n1.9.2-15\n"},{"id":"242380","messageId":"ee7b2aa742a2fd287a57a38239d5eb71b9f50ef9.1400678003.git.Alex.Crezoff@gmail.com","threadId":"36676","inReplyTo":"cover.1400678003.git.Alex.Crezoff@gmail.com","subject":"[PATCH v4 5/5] pretty.c: format string with truncate respects logOutputEncoding","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2014-05-21T13:20:07Z","receivedAt":"2014-05-21T13:20:07Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\nlength with an appropriate padding. This works for non-ASCII texts when\ni18n.logOutputEncoding is UTF-8 only (independently of a printed commit\nmessage encoding) but does not work when i18n.logOutputEncoding is NOT\nUTF-8.\n\nIn 7e77df3 (pretty: two phase conversion for non utf-8 commits, 2013-04-19)\n'format_commit_item' function assumes commit message to be in UTF-8.\nAnd that was so until ecaee80 (pretty: --format output should honor\nlogOutputEncoding, 2013-06-26) where conversion to logOutputEncoding was\nadded before calling 'format_commit_message'.\n\nCorrect this by converting a commit message to UTF-8 first (as it\nassumed in 7e77df3 (pretty: two phase conversion for non utf-8 commits,\n2013-04-19)). Only after that convert a commit message to an actual\nlogOutputEncoding.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nReviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n pretty.c                      | 7 ++++++-\n t/t4205-log-pretty-formats.sh | 8 ++++----\n t/t6006-rev-list-format.sh    | 6 +++---\n 3 files changed, 13 insertions(+), 8 deletions(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 6e266dd..25e8825 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1507,13 +1507,18 @@ void format_commit_message(const struct commit *commit,\n \tcontext.commit = commit;\n \tcontext.pretty_ctx = pretty_ctx;\n \tcontext.wrap_start = sb->len;\n+\t/*\n+\t * convert a commit message to UTF-8 first\n+\t * as far as 'format_commit_item' assumes it in UTF-8\n+\t */\n \tcontext.message = logmsg_reencode(commit,\n \t\t\t\t\t  &context.commit_encoding,\n-\t\t\t\t\t  output_enc);\n+\t\t\t\t\t  utf8);\n \n \tstrbuf_expand(sb, format, format_commit_item, &context);\n \trewrap_message_tail(sb, &context, 0, 0, 0);\n \n+\t/* then convert a commit message to an actual output encoding */\n \tif (output_enc) {\n \t\tif (same_encoding(utf8, output_enc))\n \t\t\toutput_enc = NULL;\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 74babce..c84ec9a 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -220,7 +220,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,trunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n message ..\n@@ -242,7 +242,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,ltrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n ..sage two\n@@ -264,7 +264,7 @@ EOF\n \ttest_cmp expected actual\n '\n \n-test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n+test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,mtrunc)%s\" >actual &&\n \tqz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n mess.. two\n@@ -420,7 +420,7 @@ initial...   A U Thor\n EOF\n \ttest_cmp expected actual\n '\n-test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n+test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '\n \tgit -c i18n.logOutputEncoding=$test_encoding log --pretty=\"tformat:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \tcat <<EOF | iconv -f utf-8 -t $test_encoding >expected &&\n short long  long long\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 42bdefe..19434ad 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -259,7 +259,7 @@ commit $head1\n $added_iso88591\n EOF\n \n-test_format complex-subject-trunc \"%<($truncate_count,trunc)%s\" failure <<EOF\n+test_format complex-subject-trunc \"%<($truncate_count,trunc)%s\" <<EOF\n commit $head3\n Test printing of c..\n commit $head2\n@@ -268,7 +268,7 @@ commit $head1\n added (hinzugef${added_utf8_part_iso88591}gt..\n EOF\n \n-test_format complex-subject-mtrunc \"%<($truncate_count,mtrunc)%s\" failure <<EOF\n+test_format complex-subject-mtrunc \"%<($truncate_count,mtrunc)%s\" <<EOF\n commit $head3\n Test prin..ex bodies\n commit $head2\n@@ -277,7 +277,7 @@ commit $head1\n added (hi..f${added_utf8_part_iso88591}gt) foo\n EOF\n \n-test_format complex-subject-ltrunc \"%<($truncate_count,ltrunc)%s\" failure <<EOF\n+test_format complex-subject-ltrunc \"%<($truncate_count,ltrunc)%s\" <<EOF\n commit $head3\n .. of complex bodies\n commit $head2\n-- \n1.9.2-15\n"},{"id":"242383","messageId":"537CC869.1020104@ramsay1.demon.co.uk","threadId":"36676","inReplyTo":"12b22fd98d687b0484d7d5e5f122d770ca56908d.1400678003.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v4 4/5] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2014-05-21T15:38:17Z","receivedAt":"2014-05-21T15:38:17Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"On 21/05/14 14:20, Alexey Shumkin wrote:\n> Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\n> length with an appropriate padding. This works for non-ASCII texts when\n> i18n.logOutputEncoding is UTF-8 only (independently of a printed commit\n> message encoding) but does not work when i18n.logOutputEncoding is NOT\n> UTF-8.\n> \n> There were no breakages as far as were no tests for the case\n> when both a commit message and logOutputEncoding are not UTF-8.\n> \n> Add failing tests for that which will be fixed in the next patch.\n> \n> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n> Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> Reviewed-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n\nHmm, I didn't really review these patches. I simply noted a problem\non my system and provided you with an extended bug-report and\nassisted you in fixing it up. So, if it even warrants a mention in\nthe commit message, then 'Helped-by:' would be nearer the mark.\n\nThanks!\n\nATB,\nRamsay Jones\n"},{"id":"242399","messageId":"xmqqwqdfovbw.fsf@gitster.dls.corp.google.com","threadId":"36676","inReplyTo":"537CC869.1020104@ramsay1.demon.co.uk","subject":"Re: [PATCH v4 4/5] t4205, t6006: Add failing tests for the case when i18n.logOutputEncoding is set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-05-21T18:11:47Z","receivedAt":"2014-05-21T18:11:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n\n> On 21/05/14 14:20, Alexey Shumkin wrote:\n>> Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given\n>> length with an appropriate padding. This works for non-ASCII texts when\n>> i18n.logOutputEncoding is UTF-8 only (independently of a printed commit\n>> message encoding) but does not work when i18n.logOutputEncoding is NOT\n>> UTF-8.\n>> \n>> There were no breakages as far as were no tests for the case\n>> when both a commit message and logOutputEncoding are not UTF-8.\n>> \n>> Add failing tests for that which will be fixed in the next patch.\n>> \n>> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\n>> Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n>> Reviewed-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n>\n> Hmm, I didn't really review these patches. I simply noted a problem\n> on my system and provided you with an extended bug-report and\n> assisted you in fixing it up. So, if it even warrants a mention in\n> the commit message, then 'Helped-by:' would be nearer the mark.\n\nI had the same impression.  The same for Duy's.\n"}]}