From: Krzysiek Pawlik <krzysiek.pawlik@people.pl>
To: Git Mailing List <git@vger.kernel.org>
Subject: Recoding of {git,cg}-log output
Date: Mon, 27 Feb 2006 01:10:44 +0100 [thread overview]
Message-ID: <44024384.4060406@people.pl> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 873 bytes --]
First: a little "why": having /usr/bin/vim as PAGER allows to enter
UTF-8 commit messages quite easily, the problem is when git-log (or
cg-log) is run in terminal that's not UTF-8. In my case: terminal is
ISO-8859-2 and:
nelchael@nelchael ~$ cat ~/.vimrc | grep gitci
au BufRead /tmp/gitci* setlocal textwidth=75 fileencoding=utf-8
encoding=utf-8 fileencodings=utf-8,default
So... having {git,cg}-log recode the log entires when displaying is
quite useful. Two patches attached:
a. git-log-recode.patch - uses iconv to recode the log output to
GIT_LOG_RECODE encoding
b. cg-log-recode.patch - the same, but for cogito
With this patches it's possible to write UTF-8 commit messages and see
them ok in non-UTF-8 terminal in log by having GIT_LOG_RECODE=iso-8859-2.
Comments?
--
Krzysiek Pawlik (Nelchael)
RLU #322999 GPG Key ID: 0xBC555551
[-- Attachment #1.2: cg-log-recode.patch --]
[-- Type: text/plain, Size: 889 bytes --]
--- /usr/bin/cg-log 2006-01-19 17:22:22.000000000 +0100
+++ bin/cg-log 2006-02-27 00:59:07.000000000 +0100
@@ -348,13 +348,21 @@
if [ "$shortlog" ]; then
# Special care here.
- $revls $sep "${ARGS[@]}" | git-shortlog | pager
+ if [ -n "${GIT_LOG_RECODE}" ]; then
+ $revls $sep "${ARGS[@]}" | git-shortlog | iconv --from-code=UTF-8 --to-code="${GIT_LOG_RECODE}" | pager
+ else
+ $revls $sep "${ARGS[@]}" | git-shortlog | pager
+ fi
exit
fi
# LESS="S" will prevent less to wrap too long titles to multiple lines;
# you can scroll horizontally.
-$revls $sep "${ARGS[@]}" | print_commit_log | _local_CG_LESS="S" pager
+if [ -n "${GIT_LOG_RECODE}" ]; then
+ $revls $sep "${ARGS[@]}" | print_commit_log | iconv --from-code=UTF-8 --to-code="${GIT_LOG_RECODE}" | _local_CG_LESS="S" pager
+else
+ $revls $sep "${ARGS[@]}" | print_commit_log | _local_CG_LESS="S" pager
+fi
exit 0
[-- Attachment #1.3: git-log-recode.patch --]
[-- Type: text/plain, Size: 544 bytes --]
--- /usr/bin/git-log 2006-02-23 18:31:32.000000000 +0100
+++ bin/git-log 2006-02-27 00:47:34.000000000 +0100
@@ -11,5 +11,11 @@
[ "$revs" ] || {
die "No HEAD ref"
}
-git-rev-list --pretty $(git-rev-parse --default HEAD "$@") |
-LESS=-S ${PAGER:-less}
+if [ -n "${GIT_LOG_RECODE}" ]; then
+ git-rev-list --pretty $(git-rev-parse --default HEAD "$@") | \
+ iconv --from-code=UTF-8 --to-code="${GIT_LOG_RECODE}" | \
+ LESS=-S ${PAGER:-less}
+else
+ git-rev-list --pretty $(git-rev-parse --default HEAD "$@") | \
+ LESS=-S ${PAGER:-less}
+fi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]
next reply other threads:[~2006-02-27 0:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-27 0:10 Krzysiek Pawlik [this message]
2006-02-27 0:36 ` Recoding of {git,cg}-log output Johannes Schindelin
2006-02-27 0:50 ` Krzysiek Pawlik
2006-02-27 1:26 ` Petr Baudis
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44024384.4060406@people.pl \
--to=krzysiek.pawlik@people.pl \
--cc=git@vger.kernel.org \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.