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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 9, 2011, 22:54 UTC
Message-ID
<7v1uvptjhr.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1315558437-6295-2-git-send-email-zapped@mail.ru>
Alexey Shumkin <zapped@mail.ru> writes:
Show 10 quoted lines
> 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... ;-)

Show 9 quoted lines
> @@ -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.
Show 5 quoted lines
>  	done >/dev/null
> +	git config --unset i18n.commitEncoding
>  	git rev-parse --verify HEAD | cut -c1-7
>  	cd "$owd"
>  }
Previous: Alexey ShumkinNext: Alexey Shumkin
Message 10 of 12 in “pretty: user format ignores i18n.logOutputEncoding setting”
  1. pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jul 25, 2011
  2. pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Jul 25, 2011
  3. Junio C HamanoJul 25, 2011
  4. Alexey ShumkinJul 26, 2011
  5. pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 9, 2011
  6. 1/2 pretty: Add failing tests: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 9, 2011
  7. 2/2 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 9, 2011
  8. pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 9, 2011
  9. 1/2 pretty: Add failing tests: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 9, 2011
  10. Junio C HamanoSep 9, 2011
  11. 0/2 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 20, 2011
  12. 2/2 pretty: user format ignores i18n.logOutputEncoding settingAlexey Shumkin, Sep 9, 2011

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.