From: Daniel Serpell <daniel.serpell@gmail.com>
To: GIT Mailing Lists <git@vger.kernel.org>
Cc: Petr Baudis <pasky@ucw.cz>
Subject: [PATCH] Colorized git log
Date: Thu, 21 Apr 2005 20:46:19 -0400 [thread overview]
Message-ID: <f0796bb7050421174647943f0c@mail.gmail.com> (raw)
In-Reply-To: <20050421224229.GR7443@pasky.ji.cz>
Hi!
On 4/21/05, Petr Baudis <pasky@ucw.cz> wrote:
>
> I made git log colorized if you pass it -c in current git-pasky.
>
This has two problems, solved in two patches:
* A space is added in front of header lines when you use color.
* It does not work in my (Debian) xterm. This is because here
"setterm" only works with TERM=linux.
-------------------------
Strip space in front of colorized header lines.
gitlog.sh: 6d24d857fb6c2f7e810954adaca1990599906f07
--- a/gitlog.sh
+++ b/gitlog.sh
@@ -27,7 +27,7 @@ fi
base=$(gitXnormid.sh -c $1) || exit 1
rev-tree $base | sort -rn | while read time commit parents; do
- echo $colheader commit ${commit%:*} $coldefault;
+ echo $colheader""commit ${commit%:*} $coldefault;
cat-file commit $commit | \
while read key rest; do
case "$key" in
@@ -43,10 +43,10 @@ rev-tree $base | sort -rn | while read t
dtz=${tz/+/+ }; dtz=${dtz/-/- }
pdate="$(date -Rud "1970-01-01 UTC + $sec sec $dtz" 2>/dev/null)"
if [ "$pdate" ]; then
- echo -n $color $key $rest | sed "s/>.*/> ${pdate/+0000/$tz}/"
+ echo -n $color$key $rest | sed "s/>.*/> ${pdate/+0000/$tz}/"
echo $coldefault
else
- echo $color $key $rest $coldefault
+ echo $color$key $rest $coldefault
fi
;;
"")
@@ -56,7 +56,7 @@ rev-tree $base | sort -rn | while read t
'
;;
*)
- echo $colheader $key $rest $coldefault
+ echo $colheader$key $rest $coldefault
;;
esac
-------------------------
Uses tput instead of setterm to set colors, seems to work with more
terminals.
gitlog.sh: 6d24d857fb6c2f7e810954adaca1990599906f07
--- a/gitlog.sh
+++ b/gitlog.sh
@@ -11,11 +11,11 @@
if [ "$1" = "-c" ]; then
shift
- colheader=$(setterm -foreground green)
- colauthor=$(setterm -foreground cyan)
- colcommitter=$(setterm -foreground magenta)
- colsignoff=$(setterm -foreground yellow)
- coldefault=$(setterm -foreground default)
+ colheader="$(tput setaf 2)"
+ colauthor="$(tput setaf 6)"
+ colcommitter="$(tput setaf 5)"
+ colsignoff="$(tput setaf 3)"
+ coldefault="$(tput op)"
else
colheader=
colauthor=
next prev parent reply other threads:[~2005-04-22 0:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-21 21:12 Colorized git log Sean
2005-04-21 22:42 ` Petr Baudis
2005-04-22 0:46 ` Daniel Serpell [this message]
2005-04-22 0:54 ` [PATCH] " Petr Baudis
2005-04-22 1:04 ` Daniel Serpell
2005-04-22 1:04 ` Steven Cole
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=f0796bb7050421174647943f0c@mail.gmail.com \
--to=daniel.serpell@gmail.com \
--cc=git@vger.kernel.org \
--cc=pasky@ucw.cz \
/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.