Subject: [PATCH 3/10] Separate handling of author and committer in commit headers

From: Jonas Fonseca <[email-masked]>
Date: Sat, 4 Jun 2005 16:40:02 +0200

Parse and print the author and committer header entries so the color logic
can be removed.

Signed-off-by: Jonas Fonseca <[email-masked]>
---

 cg-log |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/cg-log b/cg-log
--- a/cg-log
+++ b/cg-log
@@ -162,6 +162,8 @@ fi
 
 $revls | $revsort | while read time commit parents; do
 	trap exit SIGPIPE
+	author=
+	committer=
 	tree=
 	parents=()
 	[ "$revfmt" = "git-rev-list" ] && commit="$time"
@@ -179,17 +181,19 @@ $revls | $revsort | while read time comm
 		while read key rest; do
 			trap exit SIGPIPE
 			case "$key" in
-			"author"|"committer")
-				if [ "$key" = "author" ]; then
-					color="$colauthor"
-				else
-					color="$colcommitter"
-				fi
-
-				date=(${rest#*> })
+			"author")
+				author="$rest"
+				date=(${author#*> })
+				pdate="$(showdate $date)"
+				[ "$pdate" ] && author="${author%> *}> $pdate"
+				echo $colauthor$key $author $coldefault
+				;;
+			"committer")
+				committer="$rest"
+				date=(${committer#*> })
 				pdate="$(showdate $date)"
-				[ "$pdate" ] && rest="${rest%> *}> $pdate"
-				echo $color$key $rest $coldefault
+				[ "$pdate" ] && committer="${committer%> *}> $pdate"
+				echo $colcommitter$key $committer $coldefault
 				;;
 			"tree")
 				tree="$rest"

-- 
Jonas Fonseca