git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marco Costalba" <mcostalba@gmail.com>
To: "Junio C Hamano" <junkio@cox.net>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: [PATCH] Add --show-size to git log to print message size
Date: Sat, 14 Jul 2007 18:52:10 +0200	[thread overview]
Message-ID: <e5bfff550707140952hb60735bi95a4f03636c4aa99@mail.gmail.com> (raw)

Print message size just before the corresponding message
to speedup the parsing by scripts/porcelains tools.

Because git log output is normally read incrementally by
porcelain tools, if message size is ignored then an
expensive seek of the delimiting char, as example '\0'
must be done when parsing the output stream.

With this patch it is possible to avoid an otherwise
mandatory seek for '\0' starting from the beginning
of log body.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---

This little patch makes great difference in loading
performance of our loved ;-) tool....and probably
also others.

Please apply.

Thanks
Marco


 log-tree.c |    3 +++
 revision.c |    4 ++++
 revision.h |    1 +
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index 8624d5a..2fb7761 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -295,6 +295,9 @@ void show_log(struct rev_info *opt,
 	if (opt->add_signoff)
  		len = append_signoff(&msgbuf, &msgbuf_len, len,
 				     opt->add_signoff);
+ 	if (opt->show_size)
+		printf("size %i\n", len);
+
  	printf("%s%s%s", msgbuf, extra, sep);
  	free(msgbuf);
 }
diff --git a/revision.c b/revision.c
index 33ee9ee..3850a1e 100644
--- a/revision.c
+++ b/revision.c
@@ -1136,6 +1136,10 @@ int setup_revisions(int argc,
 				continue;
 			}
+			if (!strcmp(arg, "--show-size")) {
+				revs->show_size = 1;
+				continue;
+			}

 			/*
 			 * Grepping the commit log
diff --git a/revision.h b/revision.h
index f46b4d5..584b3f1 100644
--- a/revision.h
+++ b/revision.h
@@ -81,6 +81,7 @@ struct rev_info {
  	const char	*log_reencode;
  	const char	*subject_prefix;
 	int		no_inline;
+	int		show_size;

 	/* Filter by commit log message */
  	struct grep_opt	*grep_filter;
-- 
1.5.3.rc0.81.g1ed84-dirty

             reply	other threads:[~2007-07-14 16:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-14 16:52 Marco Costalba [this message]
2007-07-14 19:03 ` [PATCH] Add --show-size to git log to print message size Junio C Hamano
2007-07-14 20:46   ` Marco Costalba
2007-07-15  9:35     ` Alex Riesen
2007-07-15 10:06       ` Marco Costalba
2007-07-15 10:48         ` Alex Riesen
2007-07-15 11:32           ` Marco Costalba
2007-07-15 12:29             ` Marco Costalba
2007-07-15 12:35               ` Sean
2007-07-15 14:58                 ` Marco Costalba
2007-07-15 15:04                   ` Sean
2007-07-15 15:58                     ` Marco Costalba
2007-07-15 16:16                       ` Sean
2007-07-15 16:27                         ` Marco Costalba
2007-07-15 16:34                           ` Sean
2007-07-15 16:54                             ` Marco Costalba
2007-07-15 18:14               ` Linus Torvalds
2007-07-15 18:45                 ` Marco Costalba
2007-07-16 12:04   ` Marco Costalba
2007-07-16 12:31     ` Alex Riesen
2007-07-16 17:50       ` Junio C Hamano
2007-07-16 17:55         ` Marco Costalba
2007-07-16 18:02           ` Marco Costalba
2007-07-16 22:37             ` Junio C Hamano
2007-07-16 17:50   ` Marco Costalba
2007-07-17  7:49 ` Andy Parkins
2007-07-17 16:36   ` Marco Costalba
2007-07-25  4:03 ` Junio C Hamano
2007-07-25  9:38   ` Marco Costalba

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=e5bfff550707140952hb60735bi95a4f03636c4aa99@mail.gmail.com \
    --to=mcostalba@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).