git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alexey Shumkin <Alex.Crezoff@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
	Alexey Shumkin <Alex.Crezoff@gmail.com>,
	git@vger.kernel.org
Subject: [PATCH v8 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding
Date: Tue,  2 Jul 2013 03:19:03 +0400	[thread overview]
Message-ID: <f0307d1e6d5bebb0a90ff1c0ffe70f8ef32f78df.1372719264.git.Alex.Crezoff@gmail.com> (raw)
In-Reply-To: <cover.1372719264.git.Alex.Crezoff@gmail.com>
In-Reply-To: <cover.1372719264.git.Alex.Crezoff@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 21895 bytes --]

One can set an alias
	$ git config 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 adds failing tests for the next patch that fixes them.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
---
 t/t4041-diff-submodule-option.sh |  35 ++++++----
 t/t4205-log-pretty-formats.sh    | 146 ++++++++++++++++++++++++---------------
 t/t6006-rev-list-format.sh       |  74 +++++++++++++++-----
 t/t7102-reset.sh                 |  31 ++++++++-
 4 files changed, 198 insertions(+), 88 deletions(-)

diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 32d4a60..d300d0c 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) 2013 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 German (translated with Google Translate), encoded in UTF-8,
+# used in sample commit log messages in add_file() function below.
+added=$(printf "hinzugef\303\274gt")
 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_iso88591=$(echo "Add $name ($added $name)" | iconv -f utf-8 -t iso8859-1) &&
+			git -c 'i18n.commitEncoding=iso8859-1' commit -m "$msg_added_iso88591"
 		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 73ba5e8..a23da67 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -1,20 +1,44 @@
 #!/bin/sh
 #
 # Copyright (c) 2010, Will Palmer
+# Copyright (c) 2013, Alexey Shumkin (+ non-UTF-8 commit encoding tests)
 #
 
 test_description='Test pretty formats'
 . ./test-lib.sh
 
+commit_msg() {
+	# String "initial. initial" partly in German
+   # (translated with Google Translate),
+	# encoded in UTF-8, used as a commit log message below.
+	msg=$(printf "initial. anf\303\244nglich")
+	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 iso8859-1 &&
+	git commit -m "$(commit_msg iso8859-1)" &&
 	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 +62,20 @@ test_expect_success 'alias user-defined format' '
 	test_cmp expected actual
 '
 
+test_expect_success 'alias user-defined tformat with %s (iso8859-1 encoding)' '
+	git config i18n.logOutputEncoding iso8859-1 &&
+	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 +109,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 +132,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,172 +146,172 @@ test_expect_success 'setup more commits' '
 	head4=$(git rev-parse --verify --short HEAD~3)
 '
 
-test_expect_success 'left alignment formatting' '
+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 &&
+	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' "
-	git log --pretty='format:%h %<|(40)%s' >actual &&
+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 &&
-	qz_to_tab_space <<\EOF >expected &&
+	qz_to_tab_space <<EOF >expected &&
 $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' '
+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 &&
+	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' '
+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 &&
+	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' '
+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 &&
+	qz_to_tab_space <<EOF >expected &&
 ..sage two
 ..sage one
 add bar  Z
-initial  Z
+$(commit_msg "" "0" ".\{11\}")
 EOF
 	test_cmp expected actual
 '
 
-test_expect_success 'left alignment formatting with mtrunc' '
+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 &&
+	qz_to_tab_space <<EOF >expected &&
 mess.. two
 mess.. one
 add bar  Z
-initial  Z
+$(commit_msg "" "4" ".\{11\}")
 EOF
 	test_cmp expected actual
 '
 
-test_expect_success 'right alignment formatting' '
+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 &&
+	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' "
-	git log --pretty='format:%h %>|(40)%s' >actual &&
+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 &&
-	qz_to_tab_space <<\EOF >expected &&
+	qz_to_tab_space <<EOF >expected &&
 $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' '
+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 &&
+	cat <<EOF >expected &&
 message two
 message one
 add bar
-initial
+$(commit_msg)
 EOF
 	test_cmp expected actual
 '
 
-test_expect_success 'center alignment formatting' '
+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 &&
+	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' "
-	git log --pretty='format:%h %><|(40)%s' >actual &&
+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 &&
-	qz_to_tab_space <<\EOF >expected &&
+	qz_to_tab_space <<EOF >expected &&
 $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' '
+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 &&
+	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' '
+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 &&
+	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
 '
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index cc1008d..e4b50ed 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -1,31 +1,44 @@
 #!/bin/sh
 
+# Copyright (c) 2009 Jens Lehmann
+# Copyright (c) 2013 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 German (translated with Google Translate), encoded in UTF-8,
+# used as a commit log message below.
+added=$(printf "added (hinzugef\303\274gt) foo")
+added_iso88591=$(echo "$added" | iconv -f utf-8 -t iso8859-1)
+# same but "changed"
+changed=$(printf "changed (ge\303\244ndert) foo")
+changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t iso8859-1)
+
 test_expect_success 'setup' '
 	: >foo &&
 	git add foo &&
-	git commit -m "added foo" &&
+	git config i18n.commitEncoding iso8859-1 &&
+	git commit -m "$added_iso88591" &&
 	head1=$(git rev-parse --verify HEAD) &&
 	head1_short=$(git rev-parse --verify --short $head1) &&
 	tree1=$(git rev-parse --verify HEAD:) &&
 	tree1_short=$(git rev-parse --verify --short $tree1) &&
-	echo changed >foo &&
-	git commit -a -m "changed foo" &&
+	echo "$changed" > foo &&
+	git commit -a -m "$changed_iso88591" &&
 	head2=$(git rev-parse --verify HEAD) &&
 	head2_short=$(git rev-parse --verify --short $head2) &&
 	tree2=$(git rev-parse --verify HEAD:) &&
 	tree2_short=$(git rev-parse --verify --short $tree2)
+	git config --unset i18n.commitEncoding
 '
 
-# usage: test_format name format_string <expected_output
+# usage: test_format name format_string [failure] <expected_output
 test_format () {
 	cat >expect.$1
-	test_expect_success "format $1" "
+	test_expect_${3:-success} "format $1" "
 		git rev-list --pretty=format:'$2' master >output.$1 &&
 		test_cmp expect.$1 output.$1
 	"
@@ -110,14 +123,16 @@ EOF
 
 test_format encoding %e <<EOF
 commit $head2
+iso8859-1
 commit $head1
+iso8859-1
 EOF
 
-test_format subject %s <<EOF
+test_format subject %s failure <<EOF
 commit $head2
-changed foo
+$changed
 commit $head1
-added foo
+$added
 EOF
 
 test_format body %b <<EOF
@@ -125,12 +140,12 @@ commit $head2
 commit $head1
 EOF
 
-test_format raw-body %B <<EOF
+test_format raw-body %B failure <<EOF
 commit $head2
-changed foo
+$changed
 
 commit $head1
-added foo
+$added
 
 EOF
 
@@ -190,12 +205,12 @@ 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' '
@@ -209,16 +224,18 @@ test_format complex-encoding %e <<EOF
 commit $head3
 iso8859-1
 commit $head2
+iso8859-1
 commit $head1
+iso8859-1
 EOF
 
 test_format complex-subject %s <<EOF
 commit $head3
 Test printing of complex bodies
 commit $head2
-changed foo
+$changed_iso88591
 commit $head1
-added foo
+$added_iso88591
 EOF
 
 test_format complex-body %b <<EOF
@@ -231,6 +248,29 @@ commit $head2
 commit $head1
 EOF
 
+# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set
+# so unset i18n.commitEncoding to test encoding conversion
+git config --unset i18n.commitEncoding
+
+test_format complex-subject-commitencoding-unset %s failure <<EOF
+commit $head3
+Test printing of complex bodies
+commit $head2
+$changed
+commit $head1
+$added
+EOF
+
+test_format complex-body-commitencoding-unset %b failure <<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!
+
+commit $head2
+commit $head1
+EOF
+
 test_expect_success '%x00 shows NUL' '
 	echo  >expect commit $head3 &&
 	echo >>expect fooQbar &&
@@ -279,12 +319,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..6a92703 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -9,6 +9,19 @@ Documented tests for git reset'
 
 . ./test-lib.sh
 
+commit_msg() {
+	# String "modify 2nd file (changed)" partly in German
+	# (translated with Google Translate),
+	# encoded in UTF-8, used as a commit log message below.
+	printf "modify 2nd file (ge\303\244ndert)" |
+	if test -n "$1"
+	then
+		iconv -f utf-8 -t $1
+	else
+		cat
+	fi
+}
+
 test_expect_success 'creating initial files and commits' '
 	test_tick &&
 	echo "1st file" >first &&
@@ -28,7 +41,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=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
 	head5=$(git rev-parse --verify HEAD)
 '
 # git log --pretty=oneline # to see those SHA1 involved
@@ -44,6 +57,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 (iso8859-1 logoutputencoding)' '
+	hex=$(git log -1 --format="%h") &&
+	git -c "i18n.logOutputEncoding=iso8859-1" reset --hard > .actual &&
+	echo HEAD is now at $hex $(commit_msg iso8859-1) > .expected &&
+	test_cmp .expected .actual
+'
+
 >.diff_expect
 >.cached_expect
 cat >.cat_expect <<EOF
@@ -304,7 +331,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=iso8859-1" commit -a -m "$(commit_msg iso8859-1)" &&
 	check_changes $head5
 '
 
-- 
1.8.3.1.16.gce2c52e

  parent reply	other threads:[~2013-07-01 23:19 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22  7:06 git log --oneline and git log --pretty=format... give differrent outputs Shumkin Alexey
2011-07-22  7:53 ` Alexey Shumkin
2011-07-25 10:31   ` [PATCH] pretty: user format ignores i18n.logOutputEncoding setting Alexey Shumkin
2011-07-25 10:31     ` Alexey Shumkin
2011-07-25 19:45       ` Junio C Hamano
2011-07-26 13:18         ` Alexey Shumkin
2011-09-09  8:43         ` [PATCH v2] " Alexey Shumkin
2011-09-09  8:43           ` [PATCH 1/2] pretty: Add failing tests: " Alexey Shumkin
2011-09-09  8:43           ` [PATCH 2/2] pretty: " Alexey Shumkin
2011-09-09  8:53         ` [PATCH v2] " Alexey Shumkin
2011-09-09  8:53           ` [PATCH 1/2] pretty: Add failing tests: " Alexey Shumkin
2011-09-09 22:54             ` Junio C Hamano
2011-09-20  8:20               ` [PATCH v3 0/2] pretty: " Alexey Shumkin
2011-09-20  8:21               ` [PATCH v3 1/2] pretty: Add failing tests: " Alexey Shumkin
2011-09-20 19:12                 ` Junio C Hamano
2011-09-20 20:46                   ` Alexey Shumkin
2013-01-24  9:10                     ` [PATCH v4 0/4] Reroll patches against v1.8.1.1 Alexey Shumkin
2013-06-20  9:26                       ` [PATCH v5 0/5] Reroll patches against v1.8.3.1 Alexey Shumkin
2013-06-20 20:10                         ` Junio C Hamano
2013-06-25  8:55                         ` [PATCH v6 " Alexey Shumkin
2013-06-25 19:28                           ` Junio C Hamano
2013-06-26  7:37                             ` Alexey Shumkin
2013-06-26 14:24                               ` Junio C Hamano
2013-06-26 10:19                           ` [PATCH v7 " Alexey Shumkin
2013-06-26 16:19                             ` Junio C Hamano
2013-07-01 23:18                             ` [PATCH v8 0/5] Reroll patches against Git v1.8.3.2 Alexey Shumkin
2013-07-02 19:41                               ` Junio C Hamano
2013-07-03 20:03                                 ` Alexey Shumkin
2013-07-03 20:06                                   ` Junio C Hamano
2013-07-04 12:45                               ` [PATCH v9 0/5] Incremental updates against 'next' branch Alexey Shumkin
2013-07-05 12:01                                 ` [PATCH v10 " Alexey Shumkin
2013-07-05 12:01                                 ` [PATCH v10 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1 Alexey Shumkin
2013-07-05 12:01                                 ` [PATCH v10 2/5] t4205 (log-pretty-formats): revert back single quotes Alexey Shumkin
2013-07-05 12:01                                 ` [PATCH v10 3/5] t4205, t6006, t7102: make functions better readable Alexey Shumkin
2013-07-05 18:38                                   ` Junio C Hamano
2013-07-05 18:45                                     ` Junio C Hamano
2013-07-05 12:01                                 ` [PATCH v10 4/5] t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18n.commitEncoding is not set Alexey Shumkin
2013-07-05 12:01                                 ` [PATCH v10 5/5] t4205 (log-pretty-formats): avoid using `sed` Alexey Shumkin
2013-07-04 12:45                               ` [PATCH v9 1/5] t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1 Alexey Shumkin
2013-07-05  6:47                                 ` Junio C Hamano
2013-07-05  8:00                                   ` Alexey Shumkin
2013-07-05  8:11                                     ` Junio C Hamano
2013-07-05  8:42                                       ` Alexey Shumkin
2013-07-05  8:56                                         ` Junio C Hamano
2013-07-04 12:45                               ` [PATCH v9 2/5] t4205: revert back single quotes Alexey Shumkin
2013-07-05  7:07                                 ` Junio C Hamano
2013-07-04 12:45                               ` [PATCH v9 3/5] t4205, t6006, t7102: make functions more readable Alexey Shumkin
2013-07-05  6:45                                 ` Junio C Hamano
2013-07-05  8:13                                   ` Alexey Shumkin
2013-07-05  8:44                                     ` Junio C Hamano
2013-07-05  8:51                                       ` Alexey Shumkin
2013-07-05  8:58                                         ` Junio C Hamano
2013-07-04 12:45                               ` [PATCH v9 4/5] t6006: add two more tests for the case i18n.commitEncoding is not set Alexey Shumkin
2013-07-05  6:52                                 ` Junio C Hamano
2013-07-05  7:04                                 ` Junio C Hamano
2013-07-05  7:46                                   ` Alexey Shumkin
2013-07-05  8:09                                     ` Junio C Hamano
2013-07-04 12:45                               ` [PATCH v9 5/5] t4205: avoid using `sed` Alexey Shumkin
2013-07-01 23:19                             ` [PATCH v8 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs Alexey Shumkin
2013-07-01 23:19                             ` [PATCH v8 2/5] t7102 (reset): " Alexey Shumkin
2013-07-01 23:19                             ` [PATCH v8 3/5] t4205 (log-pretty-formats): " Alexey Shumkin
2013-07-01 23:19                             ` Alexey Shumkin [this message]
2013-07-02  6:46                               ` [PATCH v8 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding Johannes Sixt
2013-07-01 23:19                             ` [PATCH v8 5/5] pretty: " Alexey Shumkin
2013-06-26 10:19                           ` [PATCH v7 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs Alexey Shumkin
2013-06-26 10:19                           ` [PATCH v7 2/5] t7102 (reset): " Alexey Shumkin
2013-06-26 10:19                           ` [PATCH v7 3/5] t4205 (log-pretty-formats): " Alexey Shumkin
2013-06-26 10:19                           ` [PATCH v7 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding Alexey Shumkin
2013-07-01  7:00                             ` Johannes Sixt
2013-07-01 22:50                               ` Alexey Shumkin
2013-07-02  7:22                                 ` Johannes Sixt
2013-07-03 20:20                                   ` Alexey Shumkin
2013-06-26 10:19                           ` [PATCH v7 5/5] pretty: " Alexey Shumkin
2013-06-25  8:55                         ` [PATCH v6 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs Alexey Shumkin
2013-06-25  8:55                         ` [PATCH v6 2/5] t7102 (reset): " Alexey Shumkin
2013-06-25  8:55                         ` [PATCH v6 3/5] t4205 (log-pretty-formats): " Alexey Shumkin
2013-06-25  8:55                         ` [PATCH v6 4/5] pretty: Add failing tests: --format output should honor logOutputEncoding Alexey Shumkin
2013-06-25  8:55                         ` [PATCH v6 5/5] pretty: " Alexey Shumkin
2013-06-20  9:26                       ` [PATCH v5 1/5] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs Alexey Shumkin
2013-06-20 20:38                         ` Junio C Hamano
2013-06-20  9:26                       ` [PATCH v5 2/5] t7102 (reset): " Alexey Shumkin
2013-06-20  9:26                       ` [PATCH v5 3/5] t4205 (log-pretty-formats): " Alexey Shumkin
2013-06-20 20:38                         ` Junio C Hamano
2013-06-20  9:26                       ` [PATCH v5 4/5] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting Alexey Shumkin
2013-06-20 20:23                         ` Junio C Hamano
2013-06-20  9:26                       ` [PATCH v5 5/5] pretty: " Alexey Shumkin
2013-06-20 20:37                         ` Junio C Hamano
2013-01-24  9:10                     ` [PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs Alexey Shumkin
2013-01-24 20:29                       ` Junio C Hamano
2013-01-25  9:20                         ` Alexey Shumkin
2013-01-25 11:06                         ` Alexey Shumkin
2013-01-25 15:16                           ` Junio C Hamano
2013-01-25 15:27                             ` Alexey Shumkin
2013-01-24  9:10                     ` [PATCH v4 2/4] t7102 (reset): refactoring: " Alexey Shumkin
2013-01-24 20:30                       ` Junio C Hamano
2013-01-25  9:08                         ` Alexey Shumkin
2013-01-24  9:10                     ` [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting Alexey Shumkin
2013-01-24 20:44                       ` Junio C Hamano
2013-01-25  9:07                         ` Alexey Shumkin
2013-01-24 21:02                       ` Junio C Hamano
2013-01-25  9:01                         ` Alexey Shumkin
2013-01-24  9:10                     ` [PATCH v4 4/4] pretty: " Alexey Shumkin
2011-09-20  8:21               ` [PATCH v3 2/2] " Alexey Shumkin
2011-09-09  8:53           ` [PATCH " Alexey Shumkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f0307d1e6d5bebb0a90ff1c0ffe70f8ef32f78df.1372719264.git.Alex.Crezoff@gmail.com \
    --to=alex.crezoff@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).