git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add --show-size to git log to print message size
@ 2007-07-14 16:52 Marco Costalba
  2007-07-14 19:03 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Marco Costalba @ 2007-07-14 16:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2007-07-25 10:03 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14 16:52 [PATCH] Add --show-size to git log to print message size Marco Costalba
2007-07-14 19:03 ` 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

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).