diff options
author | Alexey Shumkin <alex.crezoff@gmail.com> | 2014-05-21 17:20:07 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-05-21 11:13:30 -0700 |
commit | 7d509878b845a2a895cc880b833a016a06199981 (patch) | |
tree | 5e40401d011a00f8e5ebf676213d80e5a492c5db /t/t4205-log-pretty-formats.sh | |
parent | d928d81051fc8475c7845526b255cb8e80b39f12 (diff) | |
download | git-7d509878b845a2a895cc880b833a016a06199981.tar.gz |
pretty.c: format string with truncate respects logOutputEncodingas/pretty-truncate
Pretty format string %<(N,[ml]trunc)>%s truncates subject to a given
length with an appropriate padding. This works for non-ASCII texts when
i18n.logOutputEncoding is UTF-8 only (independently of a printed commit
message encoding) but does not work when i18n.logOutputEncoding is NOT
UTF-8.
In 7e77df3 (pretty: two phase conversion for non utf-8 commits, 2013-04-19)
'format_commit_item' function assumes commit message to be in UTF-8.
And that was so until ecaee80 (pretty: --format output should honor
logOutputEncoding, 2013-06-26) where conversion to logOutputEncoding was
added before calling 'format_commit_message'.
Correct this by converting a commit message to UTF-8 first (as it
assumed in 7e77df3 (pretty: two phase conversion for non utf-8 commits,
2013-04-19)). Only after that convert a commit message to an actual
logOutputEncoding.
Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4205-log-pretty-formats.sh')
-rwxr-xr-x | t/t4205-log-pretty-formats.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh index 74babced70..c84ec9ae61 100755 --- a/t/t4205-log-pretty-formats.sh +++ b/t/t4205-log-pretty-formats.sh @@ -220,7 +220,7 @@ EOF test_cmp expected actual ' -test_expect_failure 'left alignment formatting with trunc. i18n.logOutputEncoding' ' +test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s" >actual && qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && message .. @@ -242,7 +242,7 @@ EOF test_cmp expected actual ' -test_expect_failure 'left alignment formatting with ltrunc. i18n.logOutputEncoding' ' +test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,ltrunc)%s" >actual && qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && ..sage two @@ -264,7 +264,7 @@ EOF test_cmp expected actual ' -test_expect_failure 'left alignment formatting with mtrunc. i18n.logOutputEncoding' ' +test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,mtrunc)%s" >actual && qz_to_tab_space <<EOF | iconv -f utf-8 -t $test_encoding >expected && mess.. two @@ -420,7 +420,7 @@ initial... A U Thor EOF test_cmp expected actual ' -test_expect_failure 'left/right alignment formatting with stealing. i18n.logOutputEncoding' ' +test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual && cat <<EOF | iconv -f utf-8 -t $test_encoding >expected && short long long long |