Git development
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: madduck@debian.org
Cc: git@vger.kernel.org
Subject: [TopGit PATCH] tg patch: disable pager and colors for git-diff
Date: Thu, 20 Nov 2008 14:57:10 +0100	[thread overview]
Message-ID: <20081120135710.GA16303@diku.dk> (raw)
In-Reply-To: <1227189062-11951-1-git-send-email-fonseca@diku.dk>

When output is not redirected to a file, git brings up the pager for
only the diff, which can be confusing, so disable with --no-pager.
git-diff is a porcelain command and thus subject to color options. Use
--no-color, to avoid the patch being corrupted with terminal escape
characters when color.diff=always.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
 tg-patch.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

 Jonas Fonseca <fonseca@diku.dk> wrote Thu, Nov 20, 2008:
 > Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
 > 
 > ---
 >  README^[[m |   11 ^[[32m+++++^[[m^[[31m------^[[m
 >  1 files changed, 5 insertions(+), 6 deletions(-)^[[m
 > 
 > ^[[1mdiff --git a/README b/README^[[m
 > ^[[1mindex 5bfe3ee..9e291da 100644^[[m
 > ^[[1m--- a/README^[[m
 > ^[[1m+++ b/README^[[m

 I hope this demonstrates the point of this patch. ;)

diff --git a/tg-patch.sh b/tg-patch.sh
index 97338ab..c2f1b56 100644
--- a/tg-patch.sh
+++ b/tg-patch.sh
@@ -34,7 +34,7 @@ git diff-tree --name-only "$base_rev" "$name" |
 	fgrep -vx ".topdeps" |
 	fgrep -vx ".topmsg" >"$git_is_stupid" || : # fgrep likes to fail randomly?
 if [ -s "$git_is_stupid" ]; then
-	cat "$git_is_stupid" | xargs git diff --patch-with-stat "$base_rev" "$name" --
+	cat "$git_is_stupid" | xargs git --no-pager diff --no-color --patch-with-stat "$base_rev" "$name" --
 else
 	echo "No changes."
 fi
-- 
tg: (f17218e..) jf/patch-no-pager-and-color (depends on: master)

-- 
Jonas Fonseca

  parent reply	other threads:[~2008-11-20 13:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20 13:51 [TopGit PATCH] README: Fix spelling Jonas Fonseca
2008-11-20 13:52 ` Jonas Fonseca
2008-11-20 14:17   ` martin f krafft
2008-11-20 14:23     ` Jonas Fonseca
2008-11-20 13:57 ` Jonas Fonseca [this message]
2008-11-20 14:34   ` [TopGit PATCH] tg patch: disable pager and colors for git-diff Petr Baudis
2008-11-20 14:55     ` Jonas Fonseca
2008-11-20 15:07       ` 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=20081120135710.GA16303@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=madduck@debian.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox