Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting
Alexey Shumkin alex.crez...@gmail.com writes: diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index c248509..4db43a4 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh ... @@ -112,12 +133,12 @@ commit $head2 commit $head1 EOF -test_format raw-body %B 'EOF' -commit 131a310eb913d107dd3c09a65d1651175898735d -changed foo +test_format failure raw-body %B EOF +commit $head2 +$changed -commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 -added foo +commit $head1 +$added EOF It may have been easier to follow if you did this Don't hardcode as a separate preparatory patch, like your first two patches. Yep, I missed that in my bunch of rebasing ;) @@ -135,16 +156,16 @@ commit $head1 foo EOF -cat commit-msg 'EOF' +iconv -f utf-8 -t cp1251 commit-msg EOF Test printing of complex bodies This commit message is much longer than the others, -and it will be encoded in iso8859-1. We should therefore -include an iso8859 character: ¡bueno! +and it will be encoded in cp1251. We should therefore +include an cp1251 character: так вот! EOF test_expect_success 'setup complex body' ' - git config i18n.commitencoding iso8859-1 + git config i18n.commitencoding cp1251 What is going on here? Is this an example that shows that i18n.commitencoding works correctly with iso8859-1 but not with cp1251? It show only that I speak and write Russian not Spanish )) I'll revert back these changes. diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index cf492f4..699c824 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh ... @@ -192,7 +214,7 @@ test_expect_success \ 'changing files and redo the last commit should succeed' ' echo 3rd line 2nd file secondfile git commit -a -C ORIG_HEAD - check_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d + check_changes f06f78b8dd468c722952b77569dd0db212442c25 test $(git rev-parse ORIG_HEAD) = \ $head5 ' This and remaining hunks to this script shows that it would be helped by the same love you gave to other scripts with your first two patches before you add the non-unicode tests, no? Sorry, I haven't got you :-[ (it seems, my English is not good enough) Do you mean avoid hardcoded SHA-1? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting
Alexey Shumkin alex.crez...@gmail.com writes: The following two commands are expected to give the same output to a terminal: $ git log --oneline --no-color $ git log --pretty=format:'%h %s' However, the former pays attention to i18n.logOutputEncoding configuration, while the latter does not when it format %s. Log messages written in an encoding i18n.commitEncoding which differs from terminal encoding are shown corrupted with the latter even when i18n.logOutputEncoding and terminal encoding are the same. The same corruption is true for $ git diff --submodule=log and $ git rev-list --pretty=format:%s HEAD and $ git reset --hard Signed-off-by: Alexey Shumkin alex.crez...@gmail.com --- t/t4041-diff-submodule-option.sh | 33 --- t/t4205-log-pretty-formats.sh| 43 +++ t/t6006-rev-list-format.sh | 90 ++-- t/t7102-reset.sh | 32 +++--- 4 files changed, 138 insertions(+), 60 deletions(-) diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh index 32d4a60..e7d6363 100755 --- a/t/t4041-diff-submodule-option.sh +++ b/t/t4041-diff-submodule-option.sh @@ -1,6 +1,7 @@ #!/bin/sh # # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin +# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests) # test_description='Support for verbose submodule differences in git diff @@ -10,6 +11,7 @@ This test tries to verify the sanity of the --submodule option of git diff. . ./test-lib.sh +added=$(printf \320\264\320\276\320\261\320\260\320\262\320\273\320\265\320\275) Please have an in-code comment before this line to explain what this variable is about, e.g. # String added in Russian, encoded in UTF-8, used in # sample commit log messages in add_file() function below. added=$(printf ...) Ok! add_file () { ( cd $1 @@ -19,7 +21,8 @@ add_file () { echo $name $name git add $name test_tick - git commit -m Add $name || exit + msg_added_cp1251=$(echo Add $name ($added $name) | iconv -f utf-8 -t cp1251) + git -c 'i18n.commitEncoding=cp1251' commit -m $msg_added_cp1251 done /dev/null git rev-parse --short --verify HEAD ) Does this patch make the all tests in this script fail for people without cp1251 locale installed? We already have tests that depend on 8859-1 and some other locales, and we'd be better off limiting such dependency to the minimum. Hmmm, I'll try to feign something to avoid using cp1251 Same comment applies to the changes to other test scripts. Thanks. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting
Alexey Shumkin alex.crez...@gmail.com writes: The following two commands are expected to give the same output to a terminal: $ git log --oneline --no-color $ git log --pretty=format:'%h %s' However, the former pays attention to i18n.logOutputEncoding configuration, while the latter does not when it format %s. Log messages written in an encoding i18n.commitEncoding which differs from terminal encoding are shown corrupted with the latter even when i18n.logOutputEncoding and terminal encoding are the same. The same corruption is true for $ git diff --submodule=log and $ git rev-list --pretty=format:%s HEAD and $ git reset --hard Signed-off-by: Alexey Shumkin alex.crez...@gmail.com --- t/t4041-diff-submodule-option.sh | 33 --- t/t4205-log-pretty-formats.sh| 43 +++ t/t6006-rev-list-format.sh | 90 ++-- t/t7102-reset.sh | 32 +++--- 4 files changed, 138 insertions(+), 60 deletions(-) diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh index 32d4a60..e7d6363 100755 --- a/t/t4041-diff-submodule-option.sh +++ b/t/t4041-diff-submodule-option.sh @@ -1,6 +1,7 @@ #!/bin/sh # # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin +# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests) # test_description='Support for verbose submodule differences in git diff @@ -10,6 +11,7 @@ This test tries to verify the sanity of the --submodule option of git diff. . ./test-lib.sh +added=$(printf \320\264\320\276\320\261\320\260\320\262\320\273\320\265\320\275) Please have an in-code comment before this line to explain what this variable is about, e.g. # String added in Russian, encoded in UTF-8, used in # sample commit log messages in add_file() function below. added=$(printf ...) add_file () { ( cd $1 @@ -19,7 +21,8 @@ add_file () { echo $name $name git add $name test_tick - git commit -m Add $name || exit + msg_added_cp1251=$(echo Add $name ($added $name) | iconv -f utf-8 -t cp1251) + git -c 'i18n.commitEncoding=cp1251' commit -m $msg_added_cp1251 done /dev/null git rev-parse --short --verify HEAD ) Does this patch make the all tests in this script fail for people without cp1251 locale installed? We already have tests that depend on 8859-1 and some other locales, and we'd be better off limiting such dependency to the minimum. Same comment applies to the changes to other test scripts. Thanks. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting
Alexey Shumkin alex.crez...@gmail.com writes: diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index c248509..4db43a4 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh ... @@ -112,12 +133,12 @@ commit $head2 commit $head1 EOF -test_format raw-body %B 'EOF' -commit 131a310eb913d107dd3c09a65d1651175898735d -changed foo +test_format failure raw-body %B EOF +commit $head2 +$changed -commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 -added foo +commit $head1 +$added EOF It may have been easier to follow if you did this Don't hardcode as a separate preparatory patch, like your first two patches. @@ -135,16 +156,16 @@ commit $head1 foo EOF -cat commit-msg 'EOF' +iconv -f utf-8 -t cp1251 commit-msg EOF Test printing of complex bodies This commit message is much longer than the others, -and it will be encoded in iso8859-1. We should therefore -include an iso8859 character: ¡bueno! +and it will be encoded in cp1251. We should therefore +include an cp1251 character: так вот! EOF test_expect_success 'setup complex body' ' - git config i18n.commitencoding iso8859-1 + git config i18n.commitencoding cp1251 What is going on here? Is this an example that shows that i18n.commitencoding works correctly with iso8859-1 but not with cp1251? diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index cf492f4..699c824 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh ... @@ -192,7 +214,7 @@ test_expect_success \ 'changing files and redo the last commit should succeed' ' echo 3rd line 2nd file secondfile git commit -a -C ORIG_HEAD - check_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d + check_changes f06f78b8dd468c722952b77569dd0db212442c25 test $(git rev-parse ORIG_HEAD) = \ $head5 ' This and remaining hunks to this script shows that it would be helped by the same love you gave to other scripts with your first two patches before you add the non-unicode tests, no? -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html