Subject: [PATCH 2/10] Separate handling of tree and parent in commit headers

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

Parse tree and parent commit header entries separately so the logic for
deciding where to save the IDs can be removed. Save all parents in an array.

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

 cg-log |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cg-log b/cg-log
--- a/cg-log
+++ b/cg-log
@@ -162,8 +162,8 @@ fi
 
 $revls | $revsort | while read time commit parents; do
 	trap exit SIGPIPE
-	tree1=
-	tree2=
+	tree=
+	parents=()
 	[ "$revfmt" = "git-rev-list" ] && commit="$time"
 	if [ $# -ne 0 ]; then
 		parent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q')
@@ -191,17 +191,17 @@ $revls | $revsort | while read time comm
 				[ "$pdate" ] && rest="${rest%> *}> $pdate"
 				echo $color$key $rest $coldefault
 				;;
-			"tree"|"parent")
-				if [ -z $tree1 ]; then
-					tree1=$rest
-				elif [ -z $tree2 ]; then
-					tree2=$rest
-				fi
+			"tree")
+				tree="$rest"
+				echo $colheader$key $tree $coldefault
+				;;
+			"parent")
+				parents[${#parents[@]}]="$rest"
 				echo $colheader$key $rest $coldefault
 				;;
 			"")
 				if [ -n "$list_files" ]; then
-					list_commit_files "$tree1" "$tree2"
+					list_commit_files "$tree" "${parents[0]}"
 				fi
 				echo; sed -re '
 					/ *Signed-off-by:.*/Is//'$colsignoff'&'$coldefault'/

-- 
Jonas Fonseca