{"thread":{"id":"3472","subject":"Recoding of {git,cg}-log output","startedAt":"2006-02-27T00:10:44Z","lastAt":"2006-02-27T01:26:56Z","messageCount":4,"participants":["Krzysiek Pawlik","Johannes Schindelin","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16779","messageId":"44024384.4060406@people.pl","threadId":"3472","inReplyTo":null,"subject":"Recoding of {git,cg}-log output","fromName":"Krzysiek Pawlik","fromEmail":"krzysiek.pawlik@people.pl","sentAt":"2006-02-27T00:10:44Z","receivedAt":"2006-02-27T00:10:44Z","isPatch":false,"sender":{"key":"krzysiek.pawlik@people.pl","avatar":"https://gravatar.com/avatar/05218c3d47410c496c83467dd36d83d4e4457f4825f00124575b50302bd952e2?d=mp&s=160"},"body":"\nFirst: a little \"why\": having /usr/bin/vim as PAGER allows to enter\nUTF-8 commit messages quite easily, the problem is when git-log (or\ncg-log) is run in terminal that's not UTF-8. In my case: terminal is\nISO-8859-2 and:\n\nnelchael@nelchael ~$ cat ~/.vimrc | grep gitci\nau BufRead /tmp/gitci* setlocal textwidth=75 fileencoding=utf-8\nencoding=utf-8 fileencodings=utf-8,default\n\nSo... having {git,cg}-log recode the log entires when displaying is\nquite useful. Two patches attached:\n\n a. git-log-recode.patch - uses iconv to recode the log output to\nGIT_LOG_RECODE encoding\n b. cg-log-recode.patch - the same, but for cogito\n\nWith this patches it's possible to write UTF-8 commit messages and see\nthem ok in non-UTF-8 terminal in log by having GIT_LOG_RECODE=iso-8859-2.\n\nComments?\n\n-- \nKrzysiek Pawlik (Nelchael)\nRLU #322999 GPG Key ID: 0xBC555551\n\n\n--- /usr/bin/cg-log\t2006-01-19 17:22:22.000000000 +0100\n+++ bin/cg-log\t2006-02-27 00:59:07.000000000 +0100\n@@ -348,13 +348,21 @@\n \n if [ \"$shortlog\" ]; then\n \t# Special care here.\n-\t$revls $sep \"${ARGS[@]}\" | git-shortlog | pager\n+\tif [ -n \"${GIT_LOG_RECODE}\" ]; then\n+\t\t$revls $sep \"${ARGS[@]}\" | git-shortlog | iconv --from-code=UTF-8 --to-code=\"${GIT_LOG_RECODE}\" | pager\n+\telse\n+\t\t$revls $sep \"${ARGS[@]}\" | git-shortlog | pager\n+\tfi\n \texit\n fi\n \n \n # LESS=\"S\" will prevent less to wrap too long titles to multiple lines;\n # you can scroll horizontally.\n-$revls $sep \"${ARGS[@]}\" | print_commit_log | _local_CG_LESS=\"S\" pager\n+if [ -n \"${GIT_LOG_RECODE}\" ]; then\n+\t$revls $sep \"${ARGS[@]}\" | print_commit_log | iconv --from-code=UTF-8 --to-code=\"${GIT_LOG_RECODE}\" | _local_CG_LESS=\"S\" pager\n+else\n+\t$revls $sep \"${ARGS[@]}\" | print_commit_log | _local_CG_LESS=\"S\" pager\n+fi\n \n exit 0\n\n\n--- /usr/bin/git-log\t2006-02-23 18:31:32.000000000 +0100\n+++ bin/git-log\t2006-02-27 00:47:34.000000000 +0100\n@@ -11,5 +11,11 @@\n [ \"$revs\" ] || {\n \tdie \"No HEAD ref\"\n }\n-git-rev-list --pretty $(git-rev-parse --default HEAD \"$@\") |\n-LESS=-S ${PAGER:-less}\n+if [ -n \"${GIT_LOG_RECODE}\" ]; then\n+\tgit-rev-list --pretty $(git-rev-parse --default HEAD \"$@\") | \\\n+\t\ticonv --from-code=UTF-8 --to-code=\"${GIT_LOG_RECODE}\" | \\\n+\t\tLESS=-S ${PAGER:-less}\n+else\n+\tgit-rev-list --pretty $(git-rev-parse --default HEAD \"$@\") | \\\n+\tLESS=-S ${PAGER:-less}\n+fi\n"},{"id":"16782","messageId":"Pine.LNX.4.63.0602270133330.5275@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"3472","inReplyTo":"44024384.4060406@people.pl","subject":"Re: Recoding of {git,cg}-log output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-02-27T00:36:34Z","receivedAt":"2006-02-27T00:36:34Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 27 Feb 2006, Krzysiek Pawlik wrote:\n\n> First: a little \"why\": having /usr/bin/vim as PAGER allows to enter\n> UTF-8 commit messages quite easily, the problem is when git-log (or\n> cg-log) is run in terminal that's not UTF-8.\n\nOf course, you could always set up a script doing the recoding and the \npaging, like\n\n-- snip --\n#!/bin/sh\n\niconv -f UTF-8 -t ISO-8859-2 \"$@\" | vim\n-- snap --\n\nand point your PAGER to that script (which is untested BTW). The advantage \nof this approach compared to adjusting git is that other programs use \nPAGER, too.\n\nHth,\nDscho\n"},{"id":"16784","messageId":"44024CC6.8010401@people.pl","threadId":"3472","inReplyTo":"Pine.LNX.4.63.0602270133330.5275@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Recoding of {git,cg}-log output","fromName":"Krzysiek Pawlik","fromEmail":"krzysiek.pawlik@people.pl","sentAt":"2006-02-27T00:50:14Z","receivedAt":"2006-02-27T00:50:14Z","isPatch":false,"sender":{"key":"krzysiek.pawlik@people.pl","avatar":"https://gravatar.com/avatar/05218c3d47410c496c83467dd36d83d4e4457f4825f00124575b50302bd952e2?d=mp&s=160"},"body":"Johannes Schindelin wrote:\n> Of course, you could always set up a script doing the recoding and\n> the paging, like\n\nNo.\n\n> The advantage of this approach compared to adjusting git is that\n> other programs use PAGER, too.\n\nPassing code (web pages, etc) throught iconv is not a good idea -\n{git,cg}-diff should show the file content as it is, not altered by iconv.\n\nChanging PAGER is a bit... ugly and messy way of doing it. Assume that I\nwork on some files and want to look at some unversioned files outside\nthe tree (like docs, man pages, whatever) and the $PAGER passes the\nlegitimate ISO8859-2 files through iconv, what gives us garbage. And we\nend up changing pager very often - Bad Idea (TM).\n\n-- \nKrzysiek Pawlik (Nelchael)\nRLU #322999 GPG Key ID: 0xBC555551\n\n"},{"id":"16787","messageId":"20060227012656.GX31278@pasky.or.cz","threadId":"3472","inReplyTo":"44024384.4060406@people.pl","subject":"Re: Recoding of {git,cg}-log output","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-02-27T01:26:56Z","receivedAt":"2006-02-27T01:26:56Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Mon, Feb 27, 2006 at 01:10:44AM CET, I got a letter\nwhere Krzysiek Pawlik <krzysiek.pawlik@people.pl> said that...\n> \n> First: a little \"why\": having /usr/bin/vim as PAGER allows to enter\n> UTF-8 commit messages quite easily, the problem is when git-log (or\n> cg-log) is run in terminal that's not UTF-8. In my case: terminal is\n> ISO-8859-2 and:\n> \n> nelchael@nelchael ~$ cat ~/.vimrc | grep gitci\n> au BufRead /tmp/gitci* setlocal textwidth=75 fileencoding=utf-8\n> encoding=utf-8 fileencodings=utf-8,default\n\nWouldn't it be enough to also set termencoding?\n\n> So... having {git,cg}-log recode the log entires when displaying is\n> quite useful. Two patches attached:\n> \n>  a. git-log-recode.patch - uses iconv to recode the log output to\n> GIT_LOG_RECODE encoding\n>  b. cg-log-recode.patch - the same, but for cogito\n> \n> With this patches it's possible to write UTF-8 commit messages and see\n> them ok in non-UTF-8 terminal in log by having GIT_LOG_RECODE=iso-8859-2.\n> \n> Comments?\n\nNot opposed in principle. But it would be much more sensible to have\nsomething like $GIT_META_ENCODING (defaulting probably to utf8), recode\nto whatever is your current locale, have the appropriate setting in the\nconfigfile, ...\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nOf the 3 great composers Mozart tells us what it's like to be human,\nBeethoven tells us what it's like to be Beethoven and Bach tells us\nwhat it's like to be the universe.  -- Douglas Adams\n"}]}