Thread (8 messages) 8 messages, 4 authors, 2016-06-15

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

flat view
DORMANTno replies

From: Jonas Fonseca <hidden>
Date: 2016-06-15 22:45:40
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 tg-patch.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

 Jonas Fonseca [off-list ref] wrote Thu, Nov 20, 2008:
 > Signed-off-by: Jonas Fonseca [off-list ref]
 > 
 > ---
 >  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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help