Thread (59 messages) flat view 59 messages, 4 authors, 2016-06-15

Re: [PATCH 1/2] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:00

Possibly related (same subject, not in this thread)

Alexey Shumkin [off-list ref] writes:
The following two ought 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". A log
messages written in an encoding i18n.commitEncoding that differs
from terminal encoding are shown corrupted with the latter even
when i18n.logOutputEncoding and terminal encoding are the same.
You seem to have inherited bad grammar from some example; I wonder
where... ;-)
quoted hunk
@@ -19,8 +21,12 @@ add_file () {
 		echo "$name" > "$name" &&
 		git add "$name" &&
 		test_tick &&
-		git commit -m "Add $name"
+		git config i18n.commitEncoding cp1251 &&
+		echo "Add $name ($added $name)" \
+			| iconv -f utf-8 -t cp1251 \
+			| xargs -I{} git commit -m "{}"
Don't do this. Format it this way instead if you want to use multi-line:

	echo "..." |
        iconv ... |
        xargs ...

I also am not sure if -I{} in xargs is all that portable. Why isn't it
more like this, which would be far easier to read?

	msg_in_cp1251=$(echo "Add ..." | iconv ...) &&
        git commit -m "$msg_in_cp1251" &&
        ...

Also do not break the && chain.
 	done >/dev/null
+	git config --unset i18n.commitEncoding
 	git rev-parse --verify HEAD | cut -c1-7
 	cd "$owd"
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help