git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Aug 20, 2010, 06:47 UTC
Message-ID
<20100820064741.GC12794@kytes>
In-Reply-To
<20100820020127.GG22469@onerussian.com>
Hi Yaroslav,
Yaroslav Halchenko writes:
Show 17 quoted lines
> 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;
 }
Previous: Yaroslav HalchenkoNext: Jonathan Nieder
Message 2 of 7 in “wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)”
  1. Yaroslav HalchenkoAug 20, 2010
  2. Ramkumar RamachandraAug 20, 2010
  3. Jonathan NiederAug 20, 2010
  4. Ramkumar RamachandraAug 20, 2010
  5. Johannes SixtAug 20, 2010
  6. Ramkumar RamachandraAug 20, 2010
  7. Johannes SixtAug 20, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.