git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Yaroslav Halchenko <debian@onerussian.com>
Cc: git@vger.kernel.org
Subject: Re: wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)
Date: Fri, 20 Aug 2010 12:17:44 +0530	[thread overview]
Message-ID: <20100820064741.GC12794@kytes> (raw)
In-Reply-To: <20100820020127.GG22469@onerussian.com>

Hi Yaroslav,

Yaroslav Halchenko writes:
> merge.log (or merge.summary) enables a really nice feature of including
> a list of commits involved in the merge.  Unfortunately it is limited to
> 20 entries and only includes total number of included commits if that is
> larger than 20.
> 
> Looking at the source code (if I got it right)
> 
> static int do_fmt_merge_msg(int merge_title, int merge_summary,
> 	struct strbuf *in, struct strbuf *out) {
> 	int limit = 20, i = 0, pos = 0;
> .... no line touches limit ....
> 			shortlog(origins.items[i].string, origins.items[i].util,
> 					head, &rev, limit, out);
> 
> so, limit of 20 is hardcoded and cannot be altered via configuration.  I
> would love to have it configurable, so, if desired, be set to infinity
> (configuration wide or as a cmd line parameter for a specific merge).

You're perhpas looking for something like this? Warning: Untested.

-- 8< --
commit 86c34c682345843d9138882a85ba36faf10e0d95
Author: Ramkumar Ramachandra <artagnon@gmail.com>
Date:   Fri Aug 20 12:12:59 2010 +0530

    fmt-merge-msg: Make the number of log entries in shortlog configurable
    
    Introduce a new configuration option called merge.logLimit to limit
    the number of log entries displayed in the shortlog of a merge commit
    configurable. Set the default value to 20.

diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index a76cd4e..30782f6 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -12,6 +12,7 @@ static const char * const fmt_merge_msg_usage[] = {
 };
 
 static int merge_summary;
+static int log_limit = 20;
 
 static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
 {
@@ -22,6 +23,8 @@ static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
 	}
 	if (!found_merge_log && !strcmp("merge.summary", key))
 		merge_summary = git_config_bool(key, value);
+	if (!strcmp("merge.logLimit", key))
+		log_limit = git_config_int(key, value);
 	return 0;
 }
 
@@ -140,7 +143,7 @@ static void print_joined(const char *singular, const char *plural,
 }
 
 static void shortlog(const char *name, unsigned char *sha1,
-		struct commit *head, struct rev_info *rev, int limit,
+		struct commit *head, struct rev_info *rev,
 		struct strbuf *out)
 {
 	int i, count = 0;
@@ -169,7 +172,7 @@ static void shortlog(const char *name, unsigned char *sha1,
 			continue;
 
 		count++;
-		if (subjects.nr > limit)
+		if (subjects.nr > log_limit)
 			continue;
 
 		format_commit_message(commit, "%s", &sb, &ctx);
@@ -182,13 +185,13 @@ static void shortlog(const char *name, unsigned char *sha1,
 			string_list_append(&subjects, strbuf_detach(&sb, NULL));
 	}
 
-	if (count > limit)
+	if (count > log_limit)
 		strbuf_addf(out, "\n* %s: (%d commits)\n", name, count);
 	else
 		strbuf_addf(out, "\n* %s:\n", name);
 
 	for (i = 0; i < subjects.nr; i++)
-		if (i >= limit)
+		if (i >= log_limit)
 			strbuf_addf(out, "  ...\n");
 		else
 			strbuf_addf(out, "  %s\n", subjects.items[i].string);
@@ -257,7 +260,7 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
 
 static int do_fmt_merge_msg(int merge_title, int merge_summary,
 	struct strbuf *in, struct strbuf *out) {
-	int limit = 20, i = 0, pos = 0;
+	int i = 0, pos = 0;
 	unsigned char head_sha1[20];
 	const char *current_branch;
 
@@ -303,7 +306,7 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,
 
 		for (i = 0; i < origins.nr; i++)
 			shortlog(origins.items[i].string, origins.items[i].util,
-					head, &rev, limit, out);
+					head, &rev, out);
 	}
 	return 0;
 }

  reply	other threads:[~2010-08-20  6:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  2:01 wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log) Yaroslav Halchenko
2010-08-20  6:47 ` Ramkumar Ramachandra [this message]
2010-08-20  8:16   ` Jonathan Nieder
2010-08-20  8:36     ` Ramkumar Ramachandra
2010-08-20  9:10     ` Johannes Sixt
2010-08-20  9:19       ` Ramkumar Ramachandra
2010-08-20  9:29         ` Johannes Sixt

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20100820064741.GC12794@kytes \
    --to=artagnon@gmail.com \
    --cc=debian@onerussian.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).