git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[TopGit PATCH] tg patch: disable pager and colors for git-diff

From
Jonas Fonseca <fonseca@diku.dk>
Date
Nov 20, 2008, 13:57 UTC
Message-ID
<20081120135710.GA16303@diku.dk>
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 |   11 +++++------
 >  1 files changed, 5 insertions(+), 6 deletions(-)
 > 
 > diff --git a/README b/README
 > index 5bfe3ee..9e291da 100644
 > --- a/README
 > +++ b/README
 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
Previous: Jonas FonsecaNext: Petr Baudis
Message 5 of 8 in “README: Fix spelling”
  1. README: Fix spellingJonas Fonseca, Nov 20, 2008
  2. Jonas FonsecaNov 20, 2008
  3. martin f krafftNov 20, 2008
  4. Jonas FonsecaNov 20, 2008
  5. tg patch: disable pager and colors for git-diffJonas Fonseca, Nov 20, 2008
  6. Petr BaudisNov 20, 2008
  7. Jonas FonsecaNov 20, 2008
  8. Petr BaudisNov 20, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.