git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v5 4/5] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting

From
Alexey Shumkin <alex.crezoff@gmail.com>
Date
Jun 20, 2013, 09:26 UTC
Message-ID
<297a5bacde1eb3cbe96a05e8ddf1783c44cba4ac.1371720245.git.Alex.Crezoff@gmail.com>
In-Reply-To
<cover.1371720245.git.Alex.Crezoff@gmail.com>
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.Crezoff@gmail.com>
---
 t/t4041-diff-submodule-option.sh |  35 +++++----
 t/t4205-log-pretty-formats.sh    | 149 ++++++++++++++++++++++++---------------
 t/t6006-rev-list-format.sh       |  85 +++++++++++++++-------
 t/t7102-reset.sh                 |  29 +++++++-
 4 files changed, 200 insertions(+), 98 deletions(-)
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 32d4a60..22bf4df 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,9 @@ This test tries to verify the sanity of the --submodule option of git diff.
 
 . ./test-lib.sh
 
+# String "added" in Russian, encoded in UTF-8, used in
+# sample commit log messages in add_file() function below.
+added=$(printf "\320\264\320\276\320\261\320\260\320\262\320\273\320\265\320\275")
 add_file () {
 	(
 		cd "$1" &&
@@ -19,7 +23,8 @@ add_file () {
 			echo "$name" >"$name" &&
 			git add "$name" &&
 			test_tick &&
-			git commit -m "Add $name" || exit
+			msg_added_iso88595=$(echo "Add $name ($added $name)" | iconv -f utf-8 -t iso88595) &&
+			git -c 'i18n.commitEncoding=iso88595' commit -m "$msg_added_iso88595"
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
@@ -89,29 +94,29 @@ test_expect_success 'diff.submodule does not affect plumbing' '
 commit_file sm1 &&
 head2=$(add_file sm1 foo3)
 
-test_expect_success 'modified submodule(forward)' '
+test_expect_failure 'modified submodule(forward)' '
 	git diff-index -p --submodule=log HEAD >actual &&
 	cat >expected <<-EOF &&
 	Submodule sm1 $head1..$head2:
-	  > Add foo3
+	  > Add foo3 ($added foo3)
 	EOF
 	test_cmp expected actual
 '
 
-test_expect_success 'modified submodule(forward)' '
+test_expect_failure 'modified submodule(forward)' '
 	git diff --submodule=log >actual &&
 	cat >expected <<-EOF &&
 	Submodule sm1 $head1..$head2:
-	  > Add foo3
+	  > Add foo3 ($added foo3)
 	EOF
 	test_cmp expected actual
 '
 
-test_expect_success 'modified submodule(forward) --submodule' '
+test_expect_failure 'modified submodule(forward) --submodule' '
 	git diff --submodule >actual &&
 	cat >expected <<-EOF &&
 	Submodule sm1 $head1..$head2:
-	  > Add foo3
+	  > Add foo3 ($added foo3)
 	EOF
 	test_cmp expected actual
 '
@@ -138,25 +143,25 @@ head3=$(
 	git rev-parse --short --verify HEAD
 )
 
-test_expect_success 'modified submodule(backward)' '
+test_expect_failure 'modified submodule(backward)' '
 	git diff-index -p --submodule=log HEAD >actual &&
 	cat >expected <<-EOF &&
 	Submodule sm1 $head2..$head3 (rewind):
-	  < Add foo3
-	  < Add foo2
+	  < Add foo3 ($added foo3)
+	  < Add foo2 ($added foo2)
 	EOF
 	test_cmp expected actual
 '
 
 head4=$(add_file sm1 foo4 foo5)
-test_expect_success 'modified submodule(backward and forward)' '
+test_expect_failure 'modified submodule(backward and forward)' '
 	git diff-index -p --submodule=log HEAD >actual &&
 	cat >expected <<-EOF &&
 	Submodule sm1 $head2...$head4:
-	  > Add foo5
-	  > Add foo4
-	  < Add foo3
-	  < Add foo2
+	  > Add foo5 ($added foo5)
+	  > Add foo4 ($added foo4)
+	  < Add foo3 ($added foo3)
+	  < Add foo2 ($added foo2)
 	EOF
 	test_cmp expected actual
 '
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 6d8d457..6a56019 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -1,20 +1,43 @@
 #!/bin/sh
 #
 # Copyright (c) 2010, Will Palmer
+# Copyright (c) 2011, Alexey Shumkin (+ non-UTF-8 commit encoding tests)
 #
 
 test_description='Test pretty formats'
 . ./test-lib.sh
 
+commit_msg() {
+	# String "initial commit" partly in Russian, encoded in UTF-8,
+	# used as a commit log message below.
+	msg=$(printf "initial \320\272\320\276\320\274\320\274\320\270\321\202")
+	if test -n "$1"
+	then
+		msg=$(echo $msg | iconv -f utf-8 -t $1)
+	fi
+	if test -n "$2" -a -n "$3"
+	then
+		# cut string, replace cut part with two dots
+		# $2 - chars count from the beginning of the string
+		# $3 - "trailing" chars
+		# LC_ALL is set to make `sed` interpret "." as a UTF-8 char not a byte
+		# as it does with C locale
+		msg=$(echo $msg | LC_ALL=en_US.UTF-8 sed -e "s/^\(.\{$2\}\)$3/\1../")
+	fi
+	echo $msg
+}
+
 test_expect_success 'set up basic repos' '
 	>foo &&
 	>bar &&
 	git add foo &&
 	test_tick &&
-	git commit -m initial &&
+	git config i18n.commitEncoding iso88595 &&
+	git commit -m "$(commit_msg iso88595)" &&
 	git add bar &&
 	test_tick &&
-	git commit -m "add bar"
+	git commit -m "add bar" &&
+	git config --unset i18n.commitEncoding
 '
 
 test_expect_success 'alias builtin format' '
@@ -38,6 +61,20 @@ test_expect_success 'alias user-defined format' '
 	test_cmp expected actual
 '
 
+test_expect_success 'alias user-defined tformat with %s (iso88595 encoding)' '
+	git config i18n.logOutputEncoding iso88595 &&
+	git log --oneline >expected-s &&
+	git log --pretty="tformat:%h %s" >actual-s &&
+	git config --unset i18n.logOutputEncoding &&
+	test_cmp expected-s actual-s
+'
+
+test_expect_failure '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
+'
+
 test_expect_success 'alias user-defined tformat' '
 	git log --pretty="tformat:%h" >expected &&
 	git config pretty.test-alias "tformat:%h" &&
@@ -71,22 +108,22 @@ test_expect_success 'alias loop' '
 	test_must_fail git log --pretty=test-foo
 '
 
-test_expect_success 'NUL separation' '
-	printf "add bar\0initial" >expected &&
+test_expect_failure 'NUL separation' '
+	printf "add bar\0$(commit_msg)" >expected &&
 	git log -z --pretty="format:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success 'NUL termination' '
-	printf "add bar\0initial\0" >expected &&
+test_expect_failure 'NUL termination' '
+	printf "add bar\0$(commit_msg)\0" >expected &&
 	git log -z --pretty="tformat:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success 'NUL separation with --stat' '
+test_expect_failure '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\0initial\n$stat1_part\n" >expected &&
+	printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
 	git log -z --stat --pretty="format:%s" >actual &&
 	test_i18ncmp expected actual
 '
@@ -94,7 +131,7 @@ test_expect_success 'NUL separation with --stat' '
 test_expect_failure 'NUL termination 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\0initial\n$stat1_part\n\0" >expected &&
+	printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n0" >expected &&
 	git log -z --stat --pretty="tformat:%s" >actual &&
 	test_i18ncmp expected actual
 '
@@ -108,20 +145,20 @@ test_expect_success 'setup more commits' '
 	head4=$(git rev-list --max-count=1 --abbrev-commit HEAD~3)
 '
 
-test_expect_success 'left alignment formatting' '
-	git log --pretty="format:%<(40)%s" >actual &&
+test_expect_failure 'left alignment formatting' "
+	git log --pretty='format:%<(40)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	qz_to_tab_space <<\EOF >expected &&
 message two                            Z
 message one                            Z
 add bar                                Z
-initial                                Z
+$(commit_msg)                         Z
 EOF
 	test_cmp expected actual
-'
+"
 
-test_expect_success 'left alignment formatting at the nth column' "
+test_expect_failure 'left alignment formatting at the nth column' "
 	git log --pretty='format:%h %<|(40)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
@@ -129,77 +166,77 @@ test_expect_success 'left alignment formatting at the nth column' "
 $head1 message two                    Z
 $head2 message one                    Z
 $head3 add bar                        Z
-$head4 initial                        Z
+$head4 $(commit_msg)                 Z
 EOF
 	test_cmp expected actual
 "
 
-test_expect_success 'left alignment formatting with no padding' '
-	git log --pretty="format:%<(1)%s" >actual &&
+test_expect_failure 'left alignment formatting with no padding' "
+	git log --pretty='format:%<(1)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	cat <<\EOF >expected &&
 message two
 message one
 add bar
-initial
+$(commit_msg)
 EOF
 	test_cmp expected actual
-'
+"
 
-test_expect_success 'left alignment formatting with trunc' '
-	git log --pretty="format:%<(10,trunc)%s" >actual &&
+test_expect_failure 'left alignment formatting with trunc' "
+	git log --pretty='format:%<(10,trunc)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	qz_to_tab_space <<\EOF >expected &&
 message ..
 message ..
 add bar  Z
-initial  Z
+$(commit_msg "" "8" ".\+$")
 EOF
 	test_cmp expected actual
-'
+"
 
-test_expect_success 'left alignment formatting with ltrunc' '
-	git log --pretty="format:%<(10,ltrunc)%s" >actual &&
+test_expect_failure 'left alignment formatting with ltrunc' "
+	git log --pretty='format:%<(10,ltrunc)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	qz_to_tab_space <<\EOF >expected &&
 ..sage two
 ..sage one
 add bar  Z
-initial  Z
+$(commit_msg "" "0" ".\{6\}")
 EOF
 	test_cmp expected actual
-'
+"
 
-test_expect_success 'left alignment formatting with mtrunc' '
-	git log --pretty="format:%<(10,mtrunc)%s" >actual &&
+test_expect_failure 'left alignment formatting with mtrunc' "
+	git log --pretty='format:%<(10,mtrunc)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	qz_to_tab_space <<\EOF >expected &&
 mess.. two
 mess.. one
 add bar  Z
-initial  Z
+$(commit_msg "" "4" ".\{6\}")
 EOF
 	test_cmp expected actual
-'
+"
 
-test_expect_success 'right alignment formatting' '
-	git log --pretty="format:%>(40)%s" >actual &&
+test_expect_failure 'right alignment formatting' "
+	git log --pretty='format:%>(40)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	qz_to_tab_space <<\EOF >expected &&
 Z                            message two
 Z                            message one
 Z                                add bar
-Z                                initial
+Z                         $(commit_msg)
 EOF
 	test_cmp expected actual
-'
+"
 
-test_expect_success 'right alignment formatting at the nth column' "
+test_expect_failure 'right alignment formatting at the nth column' "
 	git log --pretty='format:%h %>|(40)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
@@ -207,38 +244,38 @@ test_expect_success 'right alignment formatting at the nth column' "
 $head1                      message two
 $head2                      message one
 $head3                          add bar
-$head4                          initial
+$head4                   $(commit_msg)
 EOF
 	test_cmp expected actual
 "
 
-test_expect_success 'right alignment formatting with no padding' '
-	git log --pretty="format:%>(1)%s" >actual &&
+test_expect_failure 'right alignment formatting with no padding' "
+	git log --pretty='format:%>(1)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	cat <<\EOF >expected &&
 message two
 message one
 add bar
-initial
+$(commit_msg)
 EOF
 	test_cmp expected actual
-'
+"
 
-test_expect_success 'center alignment formatting' '
-	git log --pretty="format:%><(40)%s" >actual &&
+test_expect_failure 'center alignment formatting' "
+	git log --pretty='format:%><(40)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	qz_to_tab_space <<\EOF >expected &&
 Z             message two              Z
 Z             message one              Z
 Z               add bar                Z
-Z               initial                Z
+Z            $(commit_msg)            Z
 EOF
 	test_cmp expected actual
-'
+"
 
-test_expect_success 'center alignment formatting at the nth column' "
+test_expect_failure 'center alignment formatting at the nth column' "
 	git log --pretty='format:%h %><|(40)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
@@ -246,36 +283,36 @@ test_expect_success 'center alignment formatting at the nth column' "
 $head1           message two          Z
 $head2           message one          Z
 $head3             add bar            Z
-$head4             initial            Z
+$head4          $(commit_msg)        Z
 EOF
 	test_cmp expected actual
 "
 
-test_expect_success 'center alignment formatting with no padding' '
-	git log --pretty="format:%><(1)%s" >actual &&
+test_expect_failure 'center alignment formatting with no padding' "
+	git log --pretty='format:%><(1)%s' >actual &&
 	# complete the incomplete line at the end
 	echo >>actual &&
 	cat <<\EOF >expected &&
 message two
 message one
 add bar
-initial
+$(commit_msg)
 EOF
 	test_cmp expected actual
-'
+"
 
-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 &&
+test_expect_failure '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
 	echo >>actual &&
 	cat <<\EOF >expected &&
 short long  long long
 message ..   A U Thor
 add bar      A U Thor
-initial      A U Thor
+$(commit_msg "" "8" ".\+$")   A U Thor
 EOF
 	test_cmp expected actual
-'
+"
 
 test_done
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index d32e65e..36e4cc0 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -1,36 +1,62 @@
 #!/bin/sh
 
+# Copyright (c) 2009 Jens Lehmann
+# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)
+
 test_description='git rev-list --pretty=format test'
 
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
 
 test_tick
+# String "added" in Russian, encoded in UTF-8,
+# used as a commit log message below.
+added=$(printf "added (\320\264\320\276\320\261\320\260\320\262\320\273\320\265\320\275) foo")
+added_iso88595=$(echo "$added" | iconv -f utf-8 -t iso88595)
+# same but "changed"
+changed=$(printf "changed (\320\264\320\276\320\261\320\260\320\262\320\273\320\265\320\275) foo")
+changed_iso88595=$(echo "$changed" | iconv -f utf-8 -t iso88595)
+
 test_expect_success 'setup' '
 	: >foo &&
 	git add foo &&
-	git commit -m "added foo" &&
+	git config i18n.commitEncoding iso88595 &&
+	git commit -m "$added_iso88595" &&
 	head1=$(git rev-parse --verify HEAD) &&
 	head1_short=$(git rev-parse --short $head1) &&
 	tree1=$(git cat-file commit HEAD | sed -n -e "s/^tree //p" -e "/^$/q") &&
 	tree1_short=$(git rev-parse --short $tree1) &&
-	echo changed >foo &&
-	git commit -a -m "changed foo" &&
+	echo "$changed" > foo &&
+	git commit -a -m "$changed_iso88595" &&
 	head2=$(git rev-parse --verify HEAD) &&
 	head2_short=$(git rev-parse --short $head2) &&
 	head2_parent=$(git cat-file commit HEAD | sed -n -e "s/^parent //p" -e "/^$/q") &&
 	head2_parent_short=$(git rev-parse --short $head2_parent) &&
 	tree2=$(git cat-file commit HEAD | sed -n -e "s/^tree //p" -e "/^$/q") &&
-	tree2_short=$(git rev-parse --short $tree2)
+	tree2_short=$(git rev-parse --short $tree2) &&
+	git config --unset i18n.commitEncoding
 '
 
-# usage: test_format name format_string <expected_output
+# usage: test_format [failure] name format_string <expected_output
 test_format () {
+	local must_fail=0
+	# if parameters count is more than 2 then test must fail
+	if test $# -gt 2
+	then
+		must_fail=1
+		# remove first parameter which is flag for test failure
+		shift
+	fi
 	cat >expect.$1
-	test_expect_success "format $1" "
-		git rev-list --pretty=format:'$2' master >output.$1 &&
-		test_cmp expect.$1 output.$1
-	"
+	name="format $1"
+	command="git rev-list --pretty=format:'$2' master >output.$1 &&
+		test_cmp expect.$1 output.$1"
+	if test $must_fail -eq 1
+	then
+		test_expect_failure "$name" "$command"
+	else
+		test_expect_success "$name" "$command"
+	fi
 }
 
 # Feed to --format to provide predictable colored sequences.
@@ -112,14 +138,16 @@ EOF
 
 test_format encoding %e <<EOF
 commit $head2
+iso88595
 commit $head1
+iso88595
 EOF
 
-test_format subject %s <<EOF
+test_format failure subject %s <<EOF
 commit $head2
-changed foo
+$changed
 commit $head1
-added foo
+$added
 EOF
 
 test_format body %b <<EOF
@@ -127,12 +155,12 @@ commit $head2
 commit $head1
 EOF
 
-test_format raw-body %B <<EOF
+test_format failure raw-body %B <<EOF
 commit $head2
-changed foo
+$changed
 
 commit $head1
-added foo
+$added
 
 EOF
 
@@ -192,42 +220,49 @@ test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '
 	)
 '
 
-cat >commit-msg <<'EOF'
+iconv -f utf-8 -t iso8859-1 > 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!
+include an iso8859 character: ¡bueno!
 EOF
 
 test_expect_success 'setup complex body' '
 	git config i18n.commitencoding iso8859-1 &&
 	echo change2 >foo && git commit -a -F commit-msg &&
 	head3=$(git rev-parse --verify HEAD) &&
-	head3_short=$(git rev-parse --short $head3)
+	head3_short=$(git rev-parse --short $head3) &&
+	# unset commit encoding config
+	# otherwise %e does not print encoding value
+	# and following test fails
+	git config --unset i18n.commitEncoding
+
 '
 
 test_format complex-encoding %e <<EOF
 commit $head3
 iso8859-1
 commit $head2
+iso88595
 commit $head1
+iso88595
 EOF
 
-test_format complex-subject %s <<EOF
+test_format failure complex-subject %s <<EOF
 commit $head3
 Test printing of complex bodies
 commit $head2
-changed foo
+$changed
 commit $head1
-added foo
+$added
 EOF
 
-test_format complex-body %b <<EOF
+test_format failure complex-body %b <<EOF
 commit $head3
 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!
+include an iso8859 character: ¡bueno!
 
 commit $head2
 commit $head1
@@ -281,12 +316,12 @@ test_expect_success 'add LF before non-empty (2)' '
 
 test_expect_success 'add SP before non-empty (1)' '
 	git show -s --pretty=format:"%s% bThanks" HEAD^^ >actual &&
-	test $(wc -w <actual) = 2
+	test $(wc -w <actual) = 3
 '
 
 test_expect_success 'add SP before non-empty (2)' '
 	git show -s --pretty=format:"%s% sThanks" HEAD^^ >actual &&
-	test $(wc -w <actual) = 4
+	test $(wc -w <actual) = 6
 '
 
 test_expect_success '--abbrev' '
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index 05dfb27..48534f1 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -9,6 +9,17 @@ Documented tests for git reset'
 
 . ./test-lib.sh
 
+commit_msg() {
+	# String "2nd file modified" in Russian, encoded in UTF-8,
+	# used as a commit log message below.
+	msg=$(printf "modify 2nd file (\320\270\320\267\320\274\320\265\320\275\321\221\320\275 \321\204\320\260\320\271\320\273)")
+	if test -n "$1"
+	then
+		msg=$(echo $msg | iconv -f utf-8 -t $1)
+	fi
+	echo $msg
+}
+
 test_expect_success 'creating initial files and commits' '
 	test_tick &&
 	echo "1st file" >first &&
@@ -28,7 +39,7 @@ test_expect_success 'creating initial files and commits' '
 
 	echo "1st line 2nd file" >secondfile &&
 	echo "2nd line 2nd file" >>secondfile &&
-	git commit -a -m "modify 2nd file" &&
+	git -c "i18n.commitEncoding=iso88595" commit -a -m "$(commit_msg iso88595)" &&
 	head5=$(git rev-parse --verify HEAD)
 '
 # git log --pretty=oneline # to see those SHA1 involved
@@ -44,6 +55,20 @@ check_changes () {
 	done | test_cmp .cat_expect -
 }
 
+test_expect_failure 'reset --hard message' '
+	hex=$(git log -1 --format="%h") &&
+	git reset --hard > .actual &&
+	echo HEAD is now at $hex $(commit_msg) > .expected &&
+	test_cmp .expected .actual
+'
+
+test_expect_success 'reset --hard message (iso88595 logoutencoding)' '
+	hex=$(git log -1 --format="%h") &&
+	git -c "i18n.logOutputEncoding=iso88595" reset --hard > .actual &&
+	echo HEAD is now at $hex $(commit_msg iso88595) > .expected &&
+	test_cmp .expected .actual
+'
+
 >.diff_expect
 >.cached_expect
 cat >.cat_expect <<EOF
@@ -304,7 +329,7 @@ test_expect_success 'redoing the last two commits should succeed' '
 
 	echo "1st line 2nd file" >secondfile &&
 	echo "2nd line 2nd file" >>secondfile &&
-	git commit -a -m "modify 2nd file" &&
+	git -c "i18n.commitEncoding=iso88595" commit -a -m "$(commit_msg iso88595)" &&
 	check_changes $head5
 '
 
-- 
1.8.3.1.15.g5c23c1e
Previous: Junio C HamanoNext: Junio C Hamano
Message 27 of 82 in “pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting”
  1. 1/2 pretty: Add failing tests: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 20, 2011
  2. 2/2 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 20, 2011
  3. Junio C HamanoSep 20, 2011
  4. Alexey ShumkinSep 20, 2011
  5. 0/4 Reroll patches against v1.8.1.1Alexey Shumkin, Jan 24, 2013
  6. 1/4 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jan 24, 2013
  7. Junio C HamanoJan 24, 2013
  8. Alexey ShumkinJan 25, 2013
  9. Alexey ShumkinJan 25, 2013
  10. Junio C HamanoJan 25, 2013
  11. Alexey ShumkinJan 25, 2013
  12. 2/4 t7102 (reset): refactoring: don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jan 24, 2013
  13. Junio C HamanoJan 24, 2013
  14. Alexey ShumkinJan 25, 2013
  15. 3/4 pretty: Add failing tests: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jan 24, 2013
  16. Junio C HamanoJan 24, 2013
  17. Alexey ShumkinJan 25, 2013
  18. Junio C HamanoJan 24, 2013
  19. Alexey ShumkinJan 25, 2013
  20. 4/4 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jan 24, 2013
  21. 0/5 Reroll patches against v1.8.3.1Alexey Shumkin, Jun 20, 2013
  22. 1/5 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 20, 2013
  23. Junio C HamanoJun 20, 2013
  24. 2/5 t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 20, 2013
  25. 3/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 20, 2013
  26. Junio C HamanoJun 20, 2013
  27. 4/5 pretty: Add failing tests: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jun 20, 2013
  28. Junio C HamanoJun 20, 2013
  29. 5/5 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jun 20, 2013
  30. Junio C HamanoJun 20, 2013
  31. Junio C HamanoJun 20, 2013
  32. 0/5 Reroll patches against v1.8.3.1Alexey Shumkin, Jun 25, 2013
  33. 1/5 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 25, 2013
  34. 2/5 t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 25, 2013
  35. 3/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 25, 2013
  36. 4/5 pretty: Add failing tests: --format output should honor logOutputEncodingAlexey Shumkin, Jun 25, 2013
  37. 5/5 pretty: --format output should honor logOutputEncodingAlexey Shumkin, Jun 25, 2013
  38. Junio C HamanoJun 25, 2013
  39. Alexey ShumkinJun 26, 2013
  40. Junio C HamanoJun 26, 2013
  41. 0/5 Reroll patches against v1.8.3.1Alexey Shumkin, Jun 26, 2013
  42. 1/5 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 26, 2013
  43. 2/5 t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 26, 2013
  44. 3/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jun 26, 2013
  45. 4/5 pretty: Add failing tests: --format output should honor logOutputEncodingAlexey Shumkin, Jun 26, 2013
  46. Johannes SixtJul 1, 2013
  47. Alexey ShumkinJul 1, 2013
  48. Johannes SixtJul 2, 2013
  49. Alexey ShumkinJul 3, 2013
  50. 5/5 pretty: --format output should honor logOutputEncodingAlexey Shumkin, Jun 26, 2013
  51. Junio C HamanoJun 26, 2013
  52. 0/5 Reroll patches against Git v1.8.3.2Alexey Shumkin, Jul 1, 2013
  53. 1/5 t6006 (rev-list-format): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jul 1, 2013
  54. 2/5 t7102 (reset): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jul 1, 2013
  55. 3/5 t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputsAlexey Shumkin, Jul 1, 2013
  56. 4/5 pretty: Add failing tests: --format output should honor logOutputEncodingAlexey Shumkin, Jul 1, 2013
  57. Johannes SixtJul 2, 2013
  58. 5/5 pretty: --format output should honor logOutputEncodingAlexey Shumkin, Jul 1, 2013
  59. Junio C HamanoJul 2, 2013
  60. Alexey ShumkinJul 3, 2013
  61. Junio C HamanoJul 3, 2013
  62. 0/5 Incremental updates against 'next' branchAlexey Shumkin, Jul 4, 2013
  63. 1/5 t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1Alexey Shumkin, Jul 4, 2013
  64. Junio C HamanoJul 5, 2013
  65. Alexey ShumkinJul 5, 2013
  66. Junio C HamanoJul 5, 2013
  67. Alexey ShumkinJul 5, 2013
  68. Junio C HamanoJul 5, 2013
  69. 2/5 t4205: revert back single quotesAlexey Shumkin, Jul 4, 2013
  70. Junio C HamanoJul 5, 2013
  71. 3/5 t4205, t6006, t7102: make functions more readableAlexey Shumkin, Jul 4, 2013
  72. Junio C HamanoJul 5, 2013
  73. Alexey ShumkinJul 5, 2013
  74. Junio C HamanoJul 5, 2013
  75. Alexey ShumkinJul 5, 2013
  76. Junio C HamanoJul 5, 2013
  77. 4/5 t6006: add two more tests for the case i18n.commitEncoding is not setAlexey Shumkin, Jul 4, 2013
  78. Junio C HamanoJul 5, 2013
  79. Junio C HamanoJul 5, 2013
  80. Alexey ShumkinJul 5, 2013
  81. Junio C HamanoJul 5, 2013
  82. 5/5 t4205: avoid using `sed`Alexey Shumkin, Jul 4, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.