public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku•dk>
To: Petr Baudis <pasky@ucw•cz>
Cc: git@vger•kernel.org
Subject: [PATCH 7/10] Move log printing to separate function
Date: Sat, 4 Jun 2005 16:42:03 +0200	[thread overview]
Message-ID: <20050604144203.GK12615@diku.dk> (raw)
In-Reply-To: <20050604143831.GD12615@diku.dk>

Each commit log is now handled in the new print_commit_log() function.

Signed-off-by: Jonas Fonseca <fonseca@diku•dk>
---

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

diff --git a/cg-log b/cg-log
--- a/cg-log
+++ b/cg-log
@@ -160,22 +160,13 @@ else
 	revfmt="git-rev-list"
 fi
 
-$revls | $revsort | while read time commit parents; do
-	trap exit SIGPIPE
+print_commit_log() {
+	commit="$1"
 	author=
 	committer=
 	tree=
 	parents=()
-	[ "$revfmt" = "git-rev-list" ] && commit="$time"
-	if [ $# -ne 0 ]; then
-		parent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q')
-		diff_ops=
-		[ "$parent" ] || diff_ops=--root
-		[ "$(git-diff-tree -r $diff_ops $commit $parent "$@")" ] || continue
-	fi
-	if [ "$user" ]; then
-		git-cat-file commit $commit | grep -e '^author ' -e '^committer ' | grep -qi "$user" || continue
-	fi
+
 	git-cat-file commit $commit | \
 		while read key rest; do
 			trap exit SIGPIPE
@@ -221,5 +212,20 @@ $revls | $revsort | while read time comm
 				;;
 			esac
 		done
+}
+
+$revls | $revsort | while read time commit parents; do
+	trap exit SIGPIPE
+	[ "$revfmt" = "git-rev-list" ] && commit="$time"
+	if [ $# -ne 0 ]; then
+		parent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q')
+		diff_ops=
+		[ "$parent" ] || diff_ops=--root
+		[ "$(git-diff-tree -r $diff_ops $commit $parent "$@")" ] || continue
+	fi
+	if [ "$user" ]; then
+		git-cat-file commit $commit | grep -e '^author ' -e '^committer ' | grep -qi "$user" || continue
+	fi
+	print_commit_log $commit
 	echo
 done | pager
-- 
Jonas Fonseca

  parent reply	other threads:[~2005-06-04 14:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-04 14:38 [PATCHSET] cg-log cleanups and enhancements Jonas Fonseca
2005-06-04 14:39 ` [PATCH 1/10] Cleanup conversion to human readable date Jonas Fonseca
2005-06-04 14:39 ` [PATCH 2/10] Separate handling of tree and parent in commit headers Jonas Fonseca
2005-06-04 14:40 ` [PATCH 3/10] Separate handling of author and committer " Jonas Fonseca
2005-06-04 14:40 ` [PATCH 4/10] First parse all commit header entries then print them Jonas Fonseca
2005-06-04 14:41 ` [PATCH 5/10] Move printing of the commit info line inside the loop Jonas Fonseca
2005-06-04 14:41 ` [PATCH 6/10] Remove the catch all rule Jonas Fonseca
2005-06-04 14:42 ` Jonas Fonseca [this message]
2005-06-04 14:42 ` [PATCH 8/10] Move the username matching inside the loop Jonas Fonseca
2005-06-04 14:43 ` [PATCH 9/10] Move file " Jonas Fonseca
2005-06-04 14:43 ` [PATCH 10/10] Add -s option to show log summary Jonas Fonseca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050604144203.GK12615@diku.dk \
    --to=fonseca@diku$(echo .)dk \
    --cc=git@vger$(echo .)kernel.org \
    --cc=pasky@ucw$(echo .)cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox