From: Jonas Fonseca Date: Sat, 04 Jun 2005 14:40:35 GMT Subject: [PATCH 4/10] First parse all commit header entries then print them Message-ID: <20050604144035.GH12615@diku.dk> In-Reply-To: <20050604143831.GD12615@diku.dk> Change the main loop to first parse all header entries before printing them. Makes the cg-log output more independent of the order of the git commit header. Signed-off-by: Jonas Fonseca --- cg-log | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/cg-log b/cg-log --- a/cg-log +++ b/cg-log @@ -183,27 +183,33 @@ $revls | $revsort | while read time comm case "$key" in "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" ] && committer="${committer%> *}> $pdate" - echo $colcommitter$key $committer $coldefault ;; "tree") tree="$rest" - echo $colheader$key $tree $coldefault ;; "parent") parents[${#parents[@]}]="$rest" - echo $colheader$key $rest $coldefault ;; "") + echo ${colheader}tree $tree $coldefault + + for parent in "${parents[@]}"; do + echo ${colheader}parent $parent $coldefault + done + + date=(${author#*> }) + pdate="$(showdate $date)" + [ "$pdate" ] && author="${author%> *}> $pdate" + echo ${colauthor}author $author $coldefault + + date=(${committer#*> }) + pdate="$(showdate $date)" + [ "$pdate" ] && committer="${committer%> *}> $pdate" + echo ${colcommitter}committer $committer $coldefault + if [ -n "$list_files" ]; then list_commit_files "$tree" "${parents[0]}" fi -- Jonas Fonseca