summaryrefslogtreecommitdiff
path: root/t/t4205-log-pretty-formats.sh
diff options
context:
space:
mode:
authorAlexey Shumkin <Alex.Crezoff@gmail.com>2013-06-26 14:19:50 +0400
committerJunio C Hamano <gitster@pobox.com>2013-06-26 11:40:31 -0700
commitecaee8050cec23eb4cf082512e907e3e52c20b57 (patch)
tree94a99119bc202b87f00f55b640f971f6306bd69e /t/t4205-log-pretty-formats.sh
parentde6029a2d7734a93a9e27b9c4471862a47dd8123 (diff)
downloadgit-ecaee8050cec23eb4cf082512e907e3e52c20b57.tar.gz
pretty: --format output should honor logOutputEncoding
One can set an alias $ git config [--global] alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit --date=local" to see the log as a pretty tree (like *gitk* but in a terminal). However, log messages written in an encoding i18n.commitEncoding which differs from terminal encoding are shown corrupted even when i18n.logOutputEncoding and terminal encoding are the same (e.g. log messages committed on a Cygwin box with Windows-1251 encoding seen on a Linux box with a UTF-8 encoding and vice versa). To simplify an example we can say 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 formats "%s". The same corruption is true for $ git diff --submodule=log and $ git rev-list --pretty=format:%s HEAD and $ git reset --hard This patch makes pretty --format honor logOutputEncoding when it formats log message. Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4205-log-pretty-formats.sh')
-rwxr-xr-xt/t4205-log-pretty-formats.sh34
1 files changed, 17 insertions, 17 deletions
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index d45aa994e6..719d132c6d 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -69,7 +69,7 @@ test_expect_success 'alias user-defined tformat with %s (iso-8859-1 encoding)' '
test_cmp expected-s actual-s
'
-test_expect_failure 'alias user-defined tformat with %s (utf-8 encoding)' '
+test_expect_success 'alias user-defined tformat with %s (utf-8 encoding)' '
git log --oneline >expected-s &&
git log --pretty="tformat:%h %s" >actual-s &&
test_cmp expected-s actual-s
@@ -108,19 +108,19 @@ test_expect_success 'alias loop' '
test_must_fail git log --pretty=test-foo
'
-test_expect_failure 'NUL separation' '
+test_expect_success 'NUL separation' '
printf "add bar\0$(commit_msg)" >expected &&
git log -z --pretty="format:%s" >actual &&
test_cmp expected actual
'
-test_expect_failure 'NUL termination' '
+test_expect_success 'NUL termination' '
printf "add bar\0$(commit_msg)\0" >expected &&
git log -z --pretty="tformat:%s" >actual &&
test_cmp expected actual
'
-test_expect_failure 'NUL separation with --stat' '
+test_expect_success 'NUL separation with --stat' '
stat0_part=$(git diff --stat HEAD^ HEAD) &&
stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
@@ -145,7 +145,7 @@ test_expect_success 'setup more commits' '
head4=$(git rev-parse --verify --short HEAD~3)
'
-test_expect_failure 'left alignment formatting' "
+test_expect_success 'left alignment formatting' "
git log --pretty='format:%<(40)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -158,7 +158,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'left alignment formatting at the nth column' "
+test_expect_success 'left alignment formatting at the nth column' "
git log --pretty='format:%h %<|(40)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -171,7 +171,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'left alignment formatting with no padding' "
+test_expect_success 'left alignment formatting with no padding' "
git log --pretty='format:%<(1)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -184,7 +184,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'left alignment formatting with trunc' "
+test_expect_success 'left alignment formatting with trunc' "
git log --pretty='format:%<(10,trunc)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -197,7 +197,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'left alignment formatting with ltrunc' "
+test_expect_success 'left alignment formatting with ltrunc' "
git log --pretty='format:%<(10,ltrunc)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -210,7 +210,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'left alignment formatting with mtrunc' "
+test_expect_success 'left alignment formatting with mtrunc' "
git log --pretty='format:%<(10,mtrunc)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -223,7 +223,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'right alignment formatting' "
+test_expect_success 'right alignment formatting' "
git log --pretty='format:%>(40)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -236,7 +236,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'right alignment formatting at the nth column' "
+test_expect_success 'right alignment formatting at the nth column' "
git log --pretty='format:%h %>|(40)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -249,7 +249,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'right alignment formatting with no padding' "
+test_expect_success 'right alignment formatting with no padding' "
git log --pretty='format:%>(1)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -262,7 +262,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'center alignment formatting' "
+test_expect_success 'center alignment formatting' "
git log --pretty='format:%><(40)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -275,7 +275,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'center alignment formatting at the nth column' "
+test_expect_success 'center alignment formatting at the nth column' "
git log --pretty='format:%h %><|(40)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -288,7 +288,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'center alignment formatting with no padding' "
+test_expect_success 'center alignment formatting with no padding' "
git log --pretty='format:%><(1)%s' >actual &&
# complete the incomplete line at the end
echo >>actual &&
@@ -301,7 +301,7 @@ EOF
test_cmp expected actual
"
-test_expect_failure 'left/right alignment formatting with stealing' "
+test_expect_success 'left/right alignment formatting with stealing' "
git commit --amend -m short --author 'long long long <long@me.com>' &&
git log --pretty='format:%<(10,trunc)%s%>>(10,ltrunc)% an' >actual &&
# complete the incomplete line at the end