{"thread":{"id":"34354","subject":"[PATCH v10 3/5] t4205, t6006, t7102: make functions better readable","startedAt":"2013-07-05T12:01:45Z","lastAt":"2013-07-05T18:45:52Z","messageCount":8,"participants":["Alexey Shumkin","Junio C Hamano"],"isPatch":true,"patchVersion":10,"patchTotal":5},"messages":[{"id":"222625","messageId":"cover.1373024281.git.Alex.Crezoff@gmail.com","threadId":"34354","inReplyTo":"cover.1372939482.git.Alex.Crezoff@gmail.com","subject":"[PATCH v10 0/5] Incremental updates against 'next' branch","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T12:01:45Z","receivedAt":"2013-07-05T12:01:45Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"This patches series includes following changes against v9\n1. [PATCH v10 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1\n    reworded. reasons of renaming explained \"here and now\" but not only\n    redirects to an older commit which did the same.\n2. [PATCH v10 2/5] t4205 (log-pretty-formats): revert back single quotes\n    little change to commit message (added \"(log-pretty-formats)\" after\n    \"t4205\")\n3. [PATCH v10 3/5] t4205, t6006, t7102: make functions better readable\n    reworded. comments reformatted. function 'test_format' refactored.\n4. [PATCH v10 4/5] t6006 (rev-list-format): add tests for \"%b\" and \"%s\" for the case i18n.commitEncoding is not set\n    reworded. Now whole file is in utf-8. Tested output messages are\n    converted from utf-8 to iso8859-1 \"on the fly\" and written fo files.\n5. [PATCH v10 5/5] t4205 (log-pretty-formats): avoid using `sed`\n    little change to commit message (added \"(log-pretty-formats)\" after\n    \"t4205\")\n\nAnd references to \"de6029a2d7734a93a9e27b9c4471862a47dd8123\" commit in\nall patch messages replaced with \"de6029a (pretty: Add failing\ntests: --format output should honor logOutputEncoding, 2013-06-26)\"\n\nP.S. This patch series is an incremental updates on top of (7c375214 t4205:\nreplace .\\+ with ..* in sed commands, 2013-07-01) as far as v7 patches\nwere applied to the 'next' branch but there were more improvements made\nin v8.\n\nAlexey Shumkin (5):\n  t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1\n  t4205 (log-pretty-formats): revert back single quotes\n  t4205, t6006, t7102: make functions better readable\n  t6006 (rev-list-format): add tests for \"%b\" and \"%s\" for the case\n    i18n.commitEncoding is not set\n  t4205 (log-pretty-formats): avoid using `sed`\n\n t/t4041-diff-submodule-option.sh |   4 +-\n t/t4205-log-pretty-formats.sh    | 143 +++++++++++++++++++--------------------\n t/t6006-rev-list-format.sh       |  83 ++++++++++++-----------\n t/t7102-reset.sh                 |  20 +++---\n 4 files changed, 125 insertions(+), 125 deletions(-)\n\n-- \n1.8.3.2.16.gb1f0d63\n"},{"id":"222624","messageId":"78abea3f2a63d42d1b3d89cd7a955da6de10242a.1373024281.git.Alex.Crezoff@gmail.com","threadId":"34354","inReplyTo":"cover.1373024281.git.Alex.Crezoff@gmail.com","subject":"[PATCH v10 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T12:01:46Z","receivedAt":"2013-07-05T12:01:46Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Both \"iso8859-1\" and \"iso-8859-1\" are understood as latin-1\nby modern platforms, but the latter is not understood by\nolder platforms; update tests to use the former.\n\nThis is in line with 3994e8a9 (t4201: use ISO8859-1 rather\nthan ISO-8859-1, 2009-12-03), which did the same.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nSuggested-by: Johannes Sixt <j.sixt@viscovery.net>\n---\n t/t4041-diff-submodule-option.sh |  4 ++--\n t/t4205-log-pretty-formats.sh    |  8 ++++----\n t/t6006-rev-list-format.sh       | 14 +++++++-------\n t/t7102-reset.sh                 | 10 +++++-----\n 4 files changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh\nindex 0a4f496..1751c83 100755\n--- a/t/t4041-diff-submodule-option.sh\n+++ b/t/t4041-diff-submodule-option.sh\n@@ -23,8 +23,8 @@ add_file () {\n \t\t\techo \"$name\" >\"$name\" &&\n \t\t\tgit add \"$name\" &&\n \t\t\ttest_tick &&\n-\t\t\tmsg_added_iso88591=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso-8859-1) &&\n-\t\t\tgit -c 'i18n.commitEncoding=iso-8859-1' commit -m \"$msg_added_iso88591\"\n+\t\t\tmsg_added_iso88591=$(echo \"Add $name ($added $name)\" | iconv -f utf-8 -t iso8859-1) &&\n+\t\t\tgit -c 'i18n.commitEncoding=iso8859-1' commit -m \"$msg_added_iso88591\"\n \t\tdone >/dev/null &&\n \t\tgit rev-parse --short --verify HEAD\n \t)\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 3cfb744..c283842 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -32,8 +32,8 @@ test_expect_success 'set up basic repos' '\n \t>bar &&\n \tgit add foo &&\n \ttest_tick &&\n-\tgit config i18n.commitEncoding iso-8859-1 &&\n-\tgit commit -m \"$(commit_msg iso-8859-1)\" &&\n+\tgit config i18n.commitEncoding iso8859-1 &&\n+\tgit commit -m \"$(commit_msg iso8859-1)\" &&\n \tgit add bar &&\n \ttest_tick &&\n \tgit commit -m \"add bar\" &&\n@@ -61,8 +61,8 @@ test_expect_success 'alias user-defined format' '\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'alias user-defined tformat with %s (iso-8859-1 encoding)' '\n-\tgit config i18n.logOutputEncoding iso-8859-1 &&\n+test_expect_success 'alias user-defined tformat with %s (iso8859-1 encoding)' '\n+\tgit config i18n.logOutputEncoding iso8859-1 &&\n \tgit log --oneline >expected-s &&\n \tgit log --pretty=\"tformat:%h %s\" >actual-s &&\n \tgit config --unset i18n.logOutputEncoding &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 380c85b..4751d22 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -12,15 +12,15 @@ test_tick\n # String \"added\" in German (translated with Google Translate), encoded in UTF-8,\n # used as a commit log message below.\n added=$(printf \"added (hinzugef\\303\\274gt) foo\")\n-added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t iso-8859-1)\n+added_iso88591=$(echo \"$added\" | iconv -f utf-8 -t iso8859-1)\n # same but \"changed\"\n changed=$(printf \"changed (ge\\303\\244ndert) foo\")\n-changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t iso-8859-1)\n+changed_iso88591=$(echo \"$changed\" | iconv -f utf-8 -t iso8859-1)\n \n test_expect_success 'setup' '\n \t: >foo &&\n \tgit add foo &&\n-\tgit config i18n.commitEncoding iso-8859-1 &&\n+\tgit config i18n.commitEncoding iso8859-1 &&\n \tgit commit -m \"$added_iso88591\" &&\n \thead1=$(git rev-parse --verify HEAD) &&\n \thead1_short=$(git rev-parse --verify --short $head1) &&\n@@ -136,9 +136,9 @@ EOF\n \n test_format encoding %e <<EOF\n commit $head2\n-iso-8859-1\n+iso8859-1\n commit $head1\n-iso-8859-1\n+iso8859-1\n EOF\n \n test_format subject %s <<EOF\n@@ -242,9 +242,9 @@ test_format complex-encoding %e <<EOF\n commit $head3\n iso8859-1\n commit $head2\n-iso-8859-1\n+iso8859-1\n commit $head1\n-iso-8859-1\n+iso8859-1\n EOF\n \n test_format complex-subject %s <<EOF\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 9132dd9..2ef96e9 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -39,7 +39,7 @@ test_expect_success 'creating initial files and commits' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit -c \"i18n.commitEncoding=iso-8859-1\" commit -a -m \"$(commit_msg iso-8859-1)\" &&\n+\tgit -c \"i18n.commitEncoding=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n \thead5=$(git rev-parse --verify HEAD)\n '\n # git log --pretty=oneline # to see those SHA1 involved\n@@ -62,10 +62,10 @@ test_expect_success 'reset --hard message' '\n \ttest_cmp .expected .actual\n '\n \n-test_expect_success 'reset --hard message (iso-8859-1 logoutencoding)' '\n+test_expect_success 'reset --hard message (iso8859-1 logoutputencoding)' '\n \thex=$(git log -1 --format=\"%h\") &&\n-\tgit -c \"i18n.logOutputEncoding=iso-8859-1\" reset --hard > .actual &&\n-\techo HEAD is now at $hex $(commit_msg iso-8859-1) > .expected &&\n+\tgit -c \"i18n.logOutputEncoding=iso8859-1\" reset --hard > .actual &&\n+\techo HEAD is now at $hex $(commit_msg iso8859-1) > .expected &&\n \ttest_cmp .expected .actual\n '\n \n@@ -329,7 +329,7 @@ test_expect_success 'redoing the last two commits should succeed' '\n \n \techo \"1st line 2nd file\" >secondfile &&\n \techo \"2nd line 2nd file\" >>secondfile &&\n-\tgit -c \"i18n.commitEncoding=iso-8859-1\" commit -a -m \"$(commit_msg iso-8859-1)\" &&\n+\tgit -c \"i18n.commitEncoding=iso8859-1\" commit -a -m \"$(commit_msg iso8859-1)\" &&\n \tcheck_changes $head5\n '\n \n-- \n1.8.3.2.16.gb1f0d63\n"},{"id":"222627","messageId":"d89f8e7b5900eddf7b60f721b3dcd9dd46c381ca.1373024281.git.Alex.Crezoff@gmail.com","threadId":"34354","inReplyTo":"cover.1373024281.git.Alex.Crezoff@gmail.com","subject":"[PATCH v10 2/5] t4205 (log-pretty-formats): revert back single quotes","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T12:01:47Z","receivedAt":"2013-07-05T12:01:47Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"In previuos commit de6029a (pretty: Add failing tests: --format output\nshould honor logOutputEncoding, 2013-06-26) single quotes were replaced\nwith double quotes to make \"$(commit_msg)\" expression in heredoc to\nwork. The same effect can be achieved by using \"EOF\" as a heredoc\ndelimiter instead of \"\\EOF\".\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nSuggested-by: Johannes Sixt <j.sixt@viscovery.net>\n---\n t/t4205-log-pretty-formats.sh | 106 +++++++++++++++++++++---------------------\n 1 file changed, 53 insertions(+), 53 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex c283842..ef9770a 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -145,174 +145,174 @@ test_expect_success 'setup more commits' '\n \thead4=$(git rev-parse --verify --short HEAD~3)\n '\n \n-test_expect_success 'left alignment formatting' \"\n-\tgit log --pretty='format:%<(40)%s' >actual &&\n+test_expect_success 'left alignment formatting' '\n+\tgit log --pretty=\"format:%<(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n message two                            Z\n message one                            Z\n add bar                                Z\n $(commit_msg)                    Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %<|(40)%s' >actual &&\n+test_expect_success 'left alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %<|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1 message two                    Z\n $head2 message one                    Z\n $head3 add bar                        Z\n $head4 $(commit_msg)            Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with no padding' \"\n-\tgit log --pretty='format:%<(1)%s' >actual &&\n+test_expect_success 'left alignment formatting with no padding' '\n+\tgit log --pretty=\"format:%<(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with trunc' \"\n-\tgit log --pretty='format:%<(10,trunc)%s' >actual &&\n+test_expect_success 'left alignment formatting with trunc' '\n+\tgit log --pretty=\"format:%<(10,trunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n message ..\n message ..\n add bar  Z\n $(commit_msg \"\" \"8\" \"..*$\")\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with ltrunc' \"\n-\tgit log --pretty='format:%<(10,ltrunc)%s' >actual &&\n+test_expect_success 'left alignment formatting with ltrunc' '\n+\tgit log --pretty=\"format:%<(10,ltrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n ..sage two\n ..sage one\n add bar  Z\n $(commit_msg \"\" \"0\" \".\\{11\\}\")\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left alignment formatting with mtrunc' \"\n-\tgit log --pretty='format:%<(10,mtrunc)%s' >actual &&\n+test_expect_success 'left alignment formatting with mtrunc' '\n+\tgit log --pretty=\"format:%<(10,mtrunc)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n mess.. two\n mess.. one\n add bar  Z\n $(commit_msg \"\" \"4\" \".\\{11\\}\")\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'right alignment formatting' \"\n-\tgit log --pretty='format:%>(40)%s' >actual &&\n+test_expect_success 'right alignment formatting' '\n+\tgit log --pretty=\"format:%>(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n Z                            message two\n Z                            message one\n Z                                add bar\n Z                    $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'right alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %>|(40)%s' >actual &&\n+test_expect_success 'right alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %>|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1                      message two\n $head2                      message one\n $head3                          add bar\n $head4              $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'right alignment formatting with no padding' \"\n-\tgit log --pretty='format:%>(1)%s' >actual &&\n+test_expect_success 'right alignment formatting with no padding' '\n+\tgit log --pretty=\"format:%>(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'center alignment formatting' \"\n-\tgit log --pretty='format:%><(40)%s' >actual &&\n+test_expect_success 'center alignment formatting' '\n+\tgit log --pretty=\"format:%><(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n Z             message two              Z\n Z             message one              Z\n Z               add bar                Z\n Z         $(commit_msg)          Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'center alignment formatting at the nth column' \"\n-\tgit log --pretty='format:%h %><|(40)%s' >actual &&\n+test_expect_success 'center alignment formatting at the nth column' '\n+\tgit log --pretty=\"format:%h %><|(40)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tqz_to_tab_space <<\\EOF >expected &&\n+\tqz_to_tab_space <<EOF >expected &&\n $head1           message two          Z\n $head2           message one          Z\n $head3             add bar            Z\n $head4       $(commit_msg)      Z\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'center alignment formatting with no padding' \"\n-\tgit log --pretty='format:%><(1)%s' >actual &&\n+test_expect_success 'center alignment formatting with no padding' '\n+\tgit log --pretty=\"format:%><(1)%s\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n message two\n message one\n add bar\n $(commit_msg)\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n-test_expect_success 'left/right alignment formatting with stealing' \"\n-\tgit commit --amend -m short --author 'long long long <long@me.com>' &&\n-\tgit log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&\n+test_expect_success 'left/right alignment formatting with stealing' '\n+\tgit commit --amend -m short --author \"long long long <long@me.com>\" &&\n+\tgit log --pretty=\"format:%<(10,trunc)%s%>>(10,ltrunc)% an\" >actual &&\n \t# complete the incomplete line at the end\n \techo >>actual &&\n-\tcat <<\\EOF >expected &&\n+\tcat <<EOF >expected &&\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n $(commit_msg \"\" \"8\" \"..*$\")   A U Thor\n EOF\n \ttest_cmp expected actual\n-\"\n+'\n \n test_done\n-- \n1.8.3.2.16.gb1f0d63\n"},{"id":"222623","messageId":"77116508da1bf88e6035cbd657c401cf96b08cbb.1373024281.git.Alex.Crezoff@gmail.com","threadId":"34354","inReplyTo":"cover.1373024281.git.Alex.Crezoff@gmail.com","subject":"[PATCH v10 3/5] t4205, t6006, t7102: make functions better readable","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T12:01:48Z","receivedAt":"2013-07-05T12:01:48Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"Function 'test_format' has become harder to read after its\nchange in de6029a2 (pretty: Add failing tests: --format output\nshould honor logOutputEncoding, 2013-06-26). Simplify it by\nmoving its \"should we expect it to fail?\" parameter to the end.\n\nNote, current code does not use this last parameter as far as there\nare no tests expected to fail. We can keep that for future use.\n\nAlso, reformat comments\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nImproved-by: Johannes Sixt <j.sixt@viscovery.net>\n---\n t/t4205-log-pretty-formats.sh |  3 ++-\n t/t6006-rev-list-format.sh    | 28 ++++++++--------------------\n t/t7102-reset.sh              | 10 ++++++----\n 3 files changed, 16 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex ef9770a..2933c63 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -8,7 +8,8 @@ test_description='Test pretty formats'\n . ./test-lib.sh\n \n commit_msg () {\n-\t# String \"initial. initial\" partly in German (translated with Google Translate),\n+\t# String \"initial. initial\" partly in German\n+\t# (translated with Google Translate),\n \t# encoded in UTF-8, used as a commit log message below.\n \tmsg=$(printf \"initial. anf\\303\\244nglich\")\n \tif test -n \"$1\"\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex 4751d22..b32405a 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -9,8 +9,9 @@ test_description='git rev-list --pretty=format test'\n . \"$TEST_DIRECTORY\"/lib-terminal.sh\n \n test_tick\n-# String \"added\" in German (translated with Google Translate), encoded in UTF-8,\n-# used as a commit log message below.\n+# 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 # same but \"changed\"\n@@ -35,26 +36,13 @@ test_expect_success 'setup' '\n \tgit config --unset i18n.commitEncoding\n '\n \n-# usage: test_format [failure] name format_string <expected_output\n+# usage: test_format name format_string [failure] <expected_output\n test_format () {\n-\tmust_fail=0\n-\t# if parameters count is more than 2 then test must fail\n-\tif test $# -gt 2\n-\tthen\n-\t\tmust_fail=1\n-\t\t# remove first parameter which is flag for test failure\n-\t\tshift\n-\tfi\n \tcat >expect.$1\n-\tname=\"format $1\"\n-\tcommand=\"git rev-list --pretty=format:'$2' master >output.$1 &&\n-\t\ttest_cmp expect.$1 output.$1\"\n-\tif test $must_fail -eq 1\n-\tthen\n-\t\ttest_expect_failure \"$name\" \"$command\"\n-\telse\n-\t\ttest_expect_success \"$name\" \"$command\"\n-\tfi\n+\ttest_expect_${3:-success} \"format $1\" \"\n+\t\tgit rev-list --pretty=format:'$2' master >output.$1 &&\n+\t\ttest_cmp expect.$1 output.$1\n+\t\"\n }\n \n # Feed to --format to provide predictable colored sequences.\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 2ef96e9..535e609 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -10,14 +10,16 @@ Documented tests for git reset'\n . ./test-lib.sh\n \n commit_msg () {\n-\t# String \"modify 2nd file (changed)\" partly in German(translated with Google Translate),\n+\t# String \"modify 2nd file (changed)\" partly in German\n+\t# (translated with Google Translate),\n \t# encoded in UTF-8, used as a commit log message below.\n-\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n+\tmsg=\"modify 2nd file (ge\\303\\244ndert)\"\n \tif test -n \"$1\"\n \tthen\n-\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n+\t\tprint \"$msg\" | iconv -f utf-8 -t \"$1\"\n+\telse\n+\t\tprint \"$msg\"\n \tfi\n-\techo $msg\n }\n \n test_expect_success 'creating initial files and commits' '\n-- \n1.8.3.2.16.gb1f0d63\n"},{"id":"222628","messageId":"a17c23d117e9457cdf131068a4aae586bda854e8.1373024281.git.Alex.Crezoff@gmail.com","threadId":"34354","inReplyTo":"cover.1373024281.git.Alex.Crezoff@gmail.com","subject":"[PATCH v10 4/5] t6006 (rev-list-format): add tests for \"%b\" and \"%s\" for the case i18n.commitEncoding is not set","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T12:01:49Z","receivedAt":"2013-07-05T12:01:49Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"In de6029a (pretty: Add failing tests: --format output should honor\nlogOutputEncoding, 2013-06-26) 'complex-subject' test was changed.\nRevert it back, because that change actually removed tests for \"%b\" and\n\"%s\" with i18n.commitEncoding set.\nAlso, add two more tests for mentioned above \"%b\" and \"%s\" to test\nencoding conversions with no i18n.commitEncoding set.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nSuggested-by: Johannes Sixt <j.sixt@viscovery.net>\n---\n t/t6006-rev-list-format.sh | 41 ++++++++++++++++++++++++++++-------------\n 1 file changed, 28 insertions(+), 13 deletions(-)\n\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex b32405a..e51d0f0 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -218,12 +218,7 @@ test_expect_success 'setup complex body' '\n \tgit config i18n.commitencoding iso8859-1 &&\n \techo change2 >foo && git commit -a -F commit-msg &&\n \thead3=$(git rev-parse --verify HEAD) &&\n-\thead3_short=$(git rev-parse --short $head3) &&\n-\t# unset commit encoding config\n-\t# otherwise %e does not print encoding value\n-\t# and following test fails\n-\tgit config --unset i18n.commitEncoding\n-\n+\thead3_short=$(git rev-parse --short $head3)\n '\n \n test_format complex-encoding %e <<EOF\n@@ -239,21 +234,41 @@ test_format complex-subject %s <<EOF\n commit $head3\n Test printing of complex bodies\n commit $head2\n-$changed\n+$changed_iso88591\n commit $head1\n-$added\n+$added_iso88591\n EOF\n \n-test_format complex-body %b <<EOF\n-commit $head3\n-This commit message is much longer than the others,\n-and it will be encoded in iso8859-1. We should therefore\n-include an iso8859 character: ¡bueno!\n+test_expect_success 'prepare expected messages (for test %b)' '\n+    cat <<-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+\n+\tcommit $head2\n+\tcommit $head1\n+EOF\n+\ticonv -f utf-8 -t iso8859-1 expected.utf-8 >expected.iso8859-1\n+'\n+\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\n+git config --unset i18n.commitEncoding\n+\n+test_format complex-subject-commitencoding-unset %s <<EOF\n+commit $head3\n+Test printing of complex bodies\n commit $head2\n+$changed\n commit $head1\n+$added\n EOF\n \n+test_format complex-body-commitencoding-unset %b <expected.utf-8\n+\n test_expect_success '%x00 shows NUL' '\n \techo  >expect commit $head3 &&\n \techo >>expect fooQbar &&\n-- \n1.8.3.2.16.gb1f0d63\n"},{"id":"222626","messageId":"3f54479bde07c3b1ca93ef1175a8ed2879179bd2.1373024281.git.Alex.Crezoff@gmail.com","threadId":"34354","inReplyTo":"cover.1373024281.git.Alex.Crezoff@gmail.com","subject":"[PATCH v10 5/5] t4205 (log-pretty-formats): avoid using `sed`","fromName":"Alexey Shumkin","fromEmail":"alex.crezoff@gmail.com","sentAt":"2013-07-05T12:01:50Z","receivedAt":"2013-07-05T12:01:50Z","isPatch":true,"sender":{"key":"alex.crezoff@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1183752?v=4"},"body":"For testing truncated log messages 'commit_msg' function uses `sed` to\ncut a message. On various platforms `sed` behaves differently and\nresults of its work depend on locales installed. So, avoid using `sed`.\nUse predefined expected outputs instead of calculated ones.\n\nSigned-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4205-log-pretty-formats.sh | 26 ++++++++++----------------\n 1 file changed, 10 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh\nindex 2933c63..73fd236 100755\n--- a/t/t4205-log-pretty-formats.sh\n+++ b/t/t4205-log-pretty-formats.sh\n@@ -7,25 +7,19 @@\n test_description='Test pretty formats'\n . ./test-lib.sh\n \n+sample_utf8_part=$(printf \"f\\303\\244ng\")\n+\n commit_msg () {\n \t# String \"initial. initial\" partly in German\n \t# (translated with Google Translate),\n \t# encoded in UTF-8, used as a commit log message below.\n-\tmsg=$(printf \"initial. anf\\303\\244nglich\")\n+\tmsg=\"initial. an${sample_utf8_part}lich\"\n \tif test -n \"$1\"\n \tthen\n-\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n-\tfi\n-\tif test -n \"$2\" -a -n \"$3\"\n-\tthen\n-\t\t# cut string, replace cut part with two dots\n-\t\t# $2 - chars count from the beginning of the string\n-\t\t# $3 - \"trailing\" chars\n-\t\t# LC_ALL is set to make `sed` interpret \".\" as a UTF-8 char not a byte\n-\t\t# as it does with C locale\n-\t\tmsg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e \"s/^\\(.\\{$2\\}\\)$3/\\1../\")\n+\t\tprint $msg | iconv -f utf-8 -t \"$1\"\n+\telse\n+\t\tprint $msg\n \tfi\n-\techo $msg\n }\n \n test_expect_success 'set up basic repos' '\n@@ -193,7 +187,7 @@ test_expect_success 'left alignment formatting with trunc' '\n message ..\n message ..\n add bar  Z\n-$(commit_msg \"\" \"8\" \"..*$\")\n+initial...\n EOF\n \ttest_cmp expected actual\n '\n@@ -206,7 +200,7 @@ test_expect_success 'left alignment formatting with ltrunc' '\n ..sage two\n ..sage one\n add bar  Z\n-$(commit_msg \"\" \"0\" \".\\{11\\}\")\n+..${sample_utf8_part}lich\n EOF\n \ttest_cmp expected actual\n '\n@@ -219,7 +213,7 @@ test_expect_success 'left alignment formatting with mtrunc' '\n mess.. two\n mess.. one\n add bar  Z\n-$(commit_msg \"\" \"4\" \".\\{11\\}\")\n+init..lich\n EOF\n \ttest_cmp expected actual\n '\n@@ -311,7 +305,7 @@ test_expect_success 'left/right alignment formatting with stealing' '\n short long  long long\n message ..   A U Thor\n add bar      A U Thor\n-$(commit_msg \"\" \"8\" \"..*$\")   A U Thor\n+initial...   A U Thor\n EOF\n \ttest_cmp expected actual\n '\n-- \n1.8.3.2.16.gb1f0d63\n"},{"id":"222646","messageId":"7va9m07syh.fsf@alter.siamese.dyndns.org","threadId":"34354","inReplyTo":"77116508da1bf88e6035cbd657c401cf96b08cbb.1373024281.git.Alex.Crezoff@gmail.com","subject":"Re: [PATCH v10 3/5] t4205, t6006, t7102: make functions better readable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T18:38:30Z","receivedAt":"2013-07-05T18:38:30Z","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> -\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n> +\tmsg=\"modify 2nd file (ge\\303\\244ndert)\"\n>  \tif test -n \"$1\"\n>  \tthen\n> -\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n> +\t\tprint \"$msg\" | iconv -f utf-8 -t \"$1\"\n> +\telse\n> +\t\tprint \"$msg\"\n>  \tfi\n> -\techo $msg\n>  }\n\nI think I'll do s/print/&f/ before queuing this.\n\nThanks.\n"},{"id":"222649","messageId":"7v61wo7sm7.fsf@alter.siamese.dyndns.org","threadId":"34354","inReplyTo":"7va9m07syh.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v10 3/5] t4205, t6006, t7102: make functions better readable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-05T18:45:52Z","receivedAt":"2013-07-05T18:45:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Alexey Shumkin <alex.crezoff@gmail.com> writes:\n>\n>> -\tmsg=$(printf \"modify 2nd file (ge\\303\\244ndert)\")\n>> +\tmsg=\"modify 2nd file (ge\\303\\244ndert)\"\n>>  \tif test -n \"$1\"\n>>  \tthen\n>> -\t\tmsg=$(echo $msg | iconv -f utf-8 -t $1)\n>> +\t\tprint \"$msg\" | iconv -f utf-8 -t \"$1\"\n>> +\telse\n>> +\t\tprint \"$msg\"\n>>  \tfi\n>> -\techo $msg\n>>  }\n>\n> I think I'll do s/print/&f/ before queuing this.\n\nAlso, I'll change the $msg constant to have \\n at the end, as we are\nlosing it by bypassing \"echo\".\n"}]}