Git development
 help / color / mirror / Atom feed
From: sean <seanlkml@sympatico.ca>
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>
Subject: Adding color to git diff output.
Date: Tue, 11 Apr 2006 18:32:45 -0400	[thread overview]
Message-ID: <BAYC1-PASMTP08B0DB32592225AAD0838AAECD0@CEZ.ICE> (raw)
Message-ID: <20060411183245.7723c70c.seanlkml@sympatico.ca> (raw)


Linus posted a colorize program a while back[1] but it wasn't taken into git.  
The patch below takes a different approach, adding a GIT_DIFF_PAGER variable.
You can use it by assigning a filter to the environment variable, like so:

export GIT_DIFF_PAGER="colordiff | less -RS"

Sean

P.S.  .gitignore is missing a few entries: "git.spec" (rpm build), "tags" 
      (ctags), and ".*.swp" (vi editor temp files).

[1] http://marc.theaimsgroup.com/?l=git&m=114315063918024&w=2


diff --git a/git-diff.sh b/git-diff.sh
index dc0dd31..f792340 100755
--- a/git-diff.sh
+++ b/git-diff.sh
@@ -69,4 +69,8 @@ case "$rev" in
 	;;
 esac
 
+if [ -n "$GIT_DIFF_PAGER" ]; then
+	cmd="$cmd | $GIT_DIFF_PAGER"
+fi
+
 eval "$cmd"

             reply	other threads:[~2006-04-11 22:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060411183245.7723c70c.seanlkml@sympatico.ca>
2006-04-11 22:32 ` sean [this message]
2006-04-11 23:12   ` Adding color to git diff output Junio C Hamano
2006-04-12  0:34     ` Linus Torvalds
     [not found]       ` <20060411203841.3b824062.seanlkml@sympatico.ca>
2006-04-12  0:38         ` sean
2006-04-12  1:03           ` Linus Torvalds
2006-04-12  7:38             ` Alex Riesen
2006-04-12 15:46               ` Linus Torvalds
2006-04-12 15:52                 ` Alex Riesen
2006-04-12  6:19           ` Junio C Hamano

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=BAYC1-PASMTP08B0DB32592225AAD0838AAECD0@CEZ.ICE \
    --to=seanlkml@sympatico.ca \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox