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

[PATCH] Add colour support in rebase and merge tree diff stats output.

From
James Bowes <jbowes@dangerouslyinc.com>
Date
May 5, 2007, 20:48 UTC
Message-ID
<1178398134288-git-send-email-jbowes@dangerouslyinc.com>

The rebase and merge commands used diff-tree to display the summary stats of what files had changed from the operation. diff-tree does not read the diff ui configuration options, so the diff.color setting was not used.

Have rebase and merge call diff rather than diff-tree, which does read the diff ui options.

Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
---
 
I'm not sure if setting GIT_PAGER to '' is the best way to disable the pager
in this case (though I'm quite certain it should be disabled), but it does
the trick. Perhaps there should be a git --no-pager option?
 git-merge.sh  |    3 ++-
 git-rebase.sh |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-merge.sh b/git-merge.sh
index 7ebbce4..351676f 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -90,7 +90,8 @@ finish () {
 	?*)
 		case "$no_summary" in
 		'')
-			git-diff-tree --stat --summary -M "$head" "$1"
+			# We want color (if set), but no pager
+			GIT_PAGER='' git-diff --stat --summary -M "$head" "$1"
 			;;
 		esac
 		;;
diff --git a/git-rebase.sh b/git-rebase.sh
index 2dc2c4f..61770b5 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -307,7 +307,8 @@ fi
 if test -n "$verbose"
 then
 	echo "Changes from $mb to $onto:"
-	git-diff-tree --stat --summary "$mb" "$onto"
+	# We want color (if set), but no pager
+	GIT_PAGER='' git-diff --stat --summary "$mb" "$onto"
 fi
 
 # Rewind the head to "$onto"; this saves our current head in ORIG_HEAD.
-- 
1.5.2.rc1.741.g85102-dirty
Message 1 of 1 in “Add colour support in rebase and merge tree diff stats output.”
  1. Add colour support in rebase and merge tree diff stats output.James Bowes, May 5, 2007

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.