From: Junio C Hamano Date: Fri, 09 Sep 2011 22:54:08 GMT Subject: Re: [PATCH 1/2] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting Message-ID: <7v1uvptjhr.fsf@alter.siamese.dyndns.org> In-Reply-To: <1315558437-6295-2-git-send-email-zapped@mail.ru> Alexey Shumkin 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... ;-) > @@ -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" > }