{"thread":{"id":"24797","subject":"wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)","startedAt":"2010-08-20T02:01:27Z","lastAt":"2010-08-20T09:29:58Z","messageCount":7,"participants":["Yaroslav Halchenko","Ramkumar Ramachandra","Jonathan Nieder","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"148498","messageId":"20100820020127.GG22469@onerussian.com","threadId":"24797","inReplyTo":null,"subject":"wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)","fromName":"Yaroslav Halchenko","fromEmail":"debian@onerussian.com","sentAt":"2010-08-20T02:01:27Z","receivedAt":"2010-08-20T02:01:27Z","isPatch":false,"sender":{"key":"debian@onerussian.com","avatar":"https://gravatar.com/avatar/9d2f005048a0274a9c26bc47a51f580e2bf631dfedfdb18370f65e08e4250317?d=mp&s=160"},"body":"Hi Git Developers,\n\nShame on me but couldn't figure out if there is any official bug tracker\nfor git -- previously I just complained here, so keeping the tradition:\n\nmerge.log (or merge.summary) enables a really nice feature of including\na list of commits involved in the merge.  Unfortunately it is limited to\n20 entries and only includes total number of included commits if that is\nlarger than 20.\n\nLooking at the source code (if I got it right)\n\nstatic int do_fmt_merge_msg(int merge_title, int merge_summary,\n\tstruct strbuf *in, struct strbuf *out) {\n\tint limit = 20, i = 0, pos = 0;\n.... no line touches limit ....\n\t\t\tshortlog(origins.items[i].string, origins.items[i].util,\n\t\t\t\t\thead, &rev, limit, out);\n\nso, limit of 20 is hardcoded and cannot be altered via configuration.  I\nwould love to have it configurable, so, if desired, be set to infinity\n(configuration wide or as a cmd line parameter for a specific merge).\n\nThanks in advance\n-- \n                                  .-.\n=------------------------------   /v\\  ----------------------------=\nKeep in touch                    // \\\\     (yoh@|www.)onerussian.com\nYaroslav Halchenko              /(   )\\               ICQ#: 60653192\n                   Linux User    ^^-^^    [175555]\n"},{"id":"148504","messageId":"20100820064741.GC12794@kytes","threadId":"24797","inReplyTo":"20100820020127.GG22469@onerussian.com","subject":"Re: wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T06:47:44Z","receivedAt":"2010-08-20T06:47:44Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Yaroslav,\n\nYaroslav Halchenko writes:\n> merge.log (or merge.summary) enables a really nice feature of including\n> a list of commits involved in the merge.  Unfortunately it is limited to\n> 20 entries and only includes total number of included commits if that is\n> larger than 20.\n> \n> Looking at the source code (if I got it right)\n> \n> static int do_fmt_merge_msg(int merge_title, int merge_summary,\n> \tstruct strbuf *in, struct strbuf *out) {\n> \tint limit = 20, i = 0, pos = 0;\n> .... no line touches limit ....\n> \t\t\tshortlog(origins.items[i].string, origins.items[i].util,\n> \t\t\t\t\thead, &rev, limit, out);\n> \n> so, limit of 20 is hardcoded and cannot be altered via configuration.  I\n> would love to have it configurable, so, if desired, be set to infinity\n> (configuration wide or as a cmd line parameter for a specific merge).\n\nYou're perhpas looking for something like this? Warning: Untested.\n\n-- 8< --\ncommit 86c34c682345843d9138882a85ba36faf10e0d95\nAuthor: Ramkumar Ramachandra <artagnon@gmail.com>\nDate:   Fri Aug 20 12:12:59 2010 +0530\n\n    fmt-merge-msg: Make the number of log entries in shortlog configurable\n    \n    Introduce a new configuration option called merge.logLimit to limit\n    the number of log entries displayed in the shortlog of a merge commit\n    configurable. Set the default value to 20.\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex a76cd4e..30782f6 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -12,6 +12,7 @@ static const char * const fmt_merge_msg_usage[] = {\n };\n \n static int merge_summary;\n+static int log_limit = 20;\n \n static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n {\n@@ -22,6 +23,8 @@ static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n \t}\n \tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n \t\tmerge_summary = git_config_bool(key, value);\n+\tif (!strcmp(\"merge.logLimit\", key))\n+\t\tlog_limit = git_config_int(key, value);\n \treturn 0;\n }\n \n@@ -140,7 +143,7 @@ static void print_joined(const char *singular, const char *plural,\n }\n \n static void shortlog(const char *name, unsigned char *sha1,\n-\t\tstruct commit *head, struct rev_info *rev, int limit,\n+\t\tstruct commit *head, struct rev_info *rev,\n \t\tstruct strbuf *out)\n {\n \tint i, count = 0;\n@@ -169,7 +172,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\t\tcontinue;\n \n \t\tcount++;\n-\t\tif (subjects.nr > limit)\n+\t\tif (subjects.nr > log_limit)\n \t\t\tcontinue;\n \n \t\tformat_commit_message(commit, \"%s\", &sb, &ctx);\n@@ -182,13 +185,13 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\t\tstring_list_append(&subjects, strbuf_detach(&sb, NULL));\n \t}\n \n-\tif (count > limit)\n+\tif (count > log_limit)\n \t\tstrbuf_addf(out, \"\\n* %s: (%d commits)\\n\", name, count);\n \telse\n \t\tstrbuf_addf(out, \"\\n* %s:\\n\", name);\n \n \tfor (i = 0; i < subjects.nr; i++)\n-\t\tif (i >= limit)\n+\t\tif (i >= log_limit)\n \t\t\tstrbuf_addf(out, \"  ...\\n\");\n \t\telse\n \t\t\tstrbuf_addf(out, \"  %s\\n\", subjects.items[i].string);\n@@ -257,7 +260,7 @@ static void do_fmt_merge_msg_title(struct strbuf *out,\n \n static int do_fmt_merge_msg(int merge_title, int merge_summary,\n \tstruct strbuf *in, struct strbuf *out) {\n-\tint limit = 20, i = 0, pos = 0;\n+\tint i = 0, pos = 0;\n \tunsigned char head_sha1[20];\n \tconst char *current_branch;\n \n@@ -303,7 +306,7 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,\n \n \t\tfor (i = 0; i < origins.nr; i++)\n \t\t\tshortlog(origins.items[i].string, origins.items[i].util,\n-\t\t\t\t\thead, &rev, limit, out);\n+\t\t\t\t\thead, &rev, out);\n \t}\n \treturn 0;\n }\n"},{"id":"148511","messageId":"20100820081641.GA32127@burratino","threadId":"24797","inReplyTo":"20100820064741.GC12794@kytes","subject":"Re: wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-20T08:16:41Z","receivedAt":"2010-08-20T08:16:41Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ramkumar Ramachandra wrote:\n\n>     fmt-merge-msg: Make the number of log entries in shortlog configurable\n>     \n>     Introduce a new configuration option called merge.logLimit to limit\n>     the number of log entries displayed in the shortlog of a merge commit\n>     configurable. Set the default value to 20.\n\nNeat.  Sign-off?\n\n> +++ b/builtin/fmt-merge-msg.c\n> @@ -22,6 +23,8 @@ static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n>  \t}\n>  \tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n>  \t\tmerge_summary = git_config_bool(key, value);\n> +\tif (!strcmp(\"merge.logLimit\", key))\n> +\t\tlog_limit = git_config_int(key, value);\n\nMaybe something like the following would be good on top (or maybe not;\nyou decide).\n\n-- 8< --\nSubject: fmt-merge-msg --log-limit to override merge.loglimit configuration\n\nYes, one can already use \"git -c merge.loglimit=n fmt-merge-msg\", but\nmaybe providing an option name makes it more obvious that this can\nbe overridden on the command-line.\n\nThis also provides --log-limit=0 / \"[merge] loglimit = 0\" to not limit\nthe number of commits summarized at all, which I would expect to\nbe the most interesting case.  So you can use\n\"git fmt-merge-msg --log-limit=0\" in your scripts to get a message\nlike\n\n\tMerge branch 'long-topic'\n\n\t * log-topic:\n\t   commit 1\n\t   commit 2\n[...]\n\t   commit 1001\n\t   commit 1002\n\nand not to limit the number of commits summarized at all.\n\nThis patch does not propagate the option from \"git merge\" yet.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nAlso untested.  I still haven't figured out the context where this\nwould be most useful, just thought it sounded like a fun idea.\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex a585dbe..3066392 100644\n--- a/Documentation/git-fmt-merge-msg.txt\n+++ b/Documentation/git-fmt-merge-msg.txt\n@@ -9,8 +9,8 @@ git-fmt-merge-msg - Produce a merge commit message\n SYNOPSIS\n --------\n [verse]\n-'git fmt-merge-msg' [--log | --no-log] <$GIT_DIR/FETCH_HEAD\n-'git fmt-merge-msg' [--log | --no-log] -F <file>\n+'git fmt-merge-msg' [--log | --no-log] [--log-limit=<n>] <$GIT_DIR/FETCH_HEAD\n+'git fmt-merge-msg' [--log | --no-log] [--log-limit=<n>] -F <file>\n \n DESCRIPTION\n -----------\n@@ -38,6 +38,11 @@ OPTIONS\n \tSynonyms to --log and --no-log; these are deprecated and will be\n \tremoved in the future.\n \n+--log-limit <n>::\n+\tTruncate --log output after <n> lines, instead of 20.  This\n+\toverrides the merge.loglimit configuration.  If <n> is 0,\n+\tdo not truncate --log output at all.\n+\n -F <file>::\n --file <file>::\n \tTake the list of merged objects from <file> instead of\n@@ -54,6 +59,11 @@ merge.summary::\n \tSynonym to `merge.log`; this is deprecated and will be removed in\n \tthe future.\n \n+merge.loglimit::\n+\tHow many commits (at maximum) to print from each merge\n+\tparent when the `--log` option is used.  The default is 20.\n+\tCan be overridden by the `--log-limit` option.\n+\n SEE ALSO\n --------\n linkgit:git-merge[1]\ndiff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt\nindex a403155..fd861b8 100644\n--- a/Documentation/merge-config.txt\n+++ b/Documentation/merge-config.txt\n@@ -10,6 +10,11 @@ merge.log::\n \tWhether to include summaries of merged commits in newly created\n \tmerge commit messages. False by default.\n \n+merge.loglimit::\n+\tHow many merged commits to summarize in the merge message if\n+\t`--log` is used.  The default is 20.  See also\n+\tlinkgit:git-fmt-merge-msg[1].\n+\n merge.renameLimit::\n \tThe number of files to consider when performing rename detection\n \tduring a merge; if not specified, defaults to the value of\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 2c1d15b..e1aefa7 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -7,7 +7,7 @@\n #include \"string-list.h\"\n \n static const char * const fmt_merge_msg_usage[] = {\n-\t\"git fmt-merge-msg [--log|--no-log] [--file <file>]\",\n+\t\"git fmt-merge-msg [--log|--no-log] [--log-limit=<num>] [--file <file>]\",\n \tNULL\n };\n \n@@ -172,7 +172,7 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\t\tcontinue;\n \n \t\tcount++;\n-\t\tif (subjects.nr > log_limit)\n+\t\tif (log_limit && subjects.nr > log_limit)\n \t\t\tcontinue;\n \n \t\tformat_commit_message(commit, \"%s\", &sb, &ctx);\n@@ -185,13 +185,13 @@ static void shortlog(const char *name, unsigned char *sha1,\n \t\t\tstring_list_append(&subjects, strbuf_detach(&sb, NULL));\n \t}\n \n-\tif (count > log_limit)\n+\tif (log_limit && count > log_limit)\n \t\tstrbuf_addf(out, \"\\n* %s: (%d commits)\\n\", name, count);\n \telse\n \t\tstrbuf_addf(out, \"\\n* %s:\\n\", name);\n \n \tfor (i = 0; i < subjects.nr; i++)\n-\t\tif (i >= log_limit)\n+\t\tif (log_limit && i >= log_limit)\n \t\t\tstrbuf_addf(out, \"  ...\\n\");\n \t\telse\n \t\t\tstrbuf_addf(out, \"  %s\\n\", subjects.items[i].string);\n@@ -327,6 +327,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\t{ OPTION_BOOLEAN, 0, \"summary\", &merge_summary, NULL,\n \t\t  \"alias for --log (deprecated)\",\n \t\t  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },\n+\t\tOPT_INTEGER(0, \"log-limit\", &log_limit,\n+\t\t\t\"truncate shortlog after <n> lines (0 for no limit)\"),\n \t\tOPT_FILENAME('F', \"file\", &inpath, \"file to read from\"),\n \t\tOPT_END()\n \t};\n-- \n"},{"id":"148512","messageId":"20100820083614.GD12794@kytes","threadId":"24797","inReplyTo":"20100820081641.GA32127@burratino","subject":"Re: wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T08:36:19Z","receivedAt":"2010-08-20T08:36:19Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Jonathan,\n\nJonathan Nieder writes:\n> Ramkumar Ramachandra wrote:\n> \n> >     fmt-merge-msg: Make the number of log entries in shortlog configurable\n> >     \n> >     Introduce a new configuration option called merge.logLimit to limit\n> >     the number of log entries displayed in the shortlog of a merge commit\n> >     configurable. Set the default value to 20.\n> \n> Neat.  Sign-off?\n\nOops. I forgot about the new policy: when a patch isn't ready for\ninclusion, I must say that explicitly and sign off so others can base\ntheir work on my patch, right?\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n\n> > +++ b/builtin/fmt-merge-msg.c\n> > @@ -22,6 +23,8 @@ static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n> >  \t}\n> >  \tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n> >  \t\tmerge_summary = git_config_bool(key, value);\n> > +\tif (!strcmp(\"merge.logLimit\", key))\n> > +\t\tlog_limit = git_config_int(key, value);\n> \n> Maybe something like the following would be good on top (or maybe not;\n> you decide).\n\nLooks good- since you're interested in this too, I'll include your\npatch, test it and post a series to the list.\n\nThanks.\n\n-- Ram\n"},{"id":"148514","messageId":"4C6E468F.3000800@viscovery.net","threadId":"24797","inReplyTo":"20100820081641.GA32127@burratino","subject":"Re: wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-08-20T09:10:39Z","receivedAt":"2010-08-20T09:10:39Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 8/20/2010 10:16, schrieb Jonathan Nieder:\n> This also provides --log-limit=0 / \"[merge] loglimit = 0\" to not limit\n> the number of commits summarized at all, which I would expect to\n...\n>  [verse]\n> -'git fmt-merge-msg' [--log | --no-log] <$GIT_DIR/FETCH_HEAD\n> -'git fmt-merge-msg' [--log | --no-log] -F <file>\n> +'git fmt-merge-msg' [--log | --no-log] [--log-limit=<n>] <$GIT_DIR/FETCH_HEAD\n> +'git fmt-merge-msg' [--log | --no-log] [--log-limit=<n>] -F <file>\n\nDo we need --log-limit? Why not just --log=42 and --no-log equals --log=0?\n\nDitto for the config option:\n\n  merge.log=42\n  merge.log=0\n\nand for backwards compatibility:\n\n  merge.log=false  ===  merge.log=0\n  merge.log=true   ===  merge.log=20\n\n-- Hannes\n"},{"id":"148516","messageId":"20100820091925.GE12794@kytes","threadId":"24797","inReplyTo":"4C6E468F.3000800@viscovery.net","subject":"Re: wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T09:19:28Z","receivedAt":"2010-08-20T09:19:28Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Johannes,\n\nJohannes Sixt writes:\n> Am 8/20/2010 10:16, schrieb Jonathan Nieder:\n> > This also provides --log-limit=0 / \"[merge] loglimit = 0\" to not limit\n> > the number of commits summarized at all, which I would expect to\n> ...\n> >  [verse]\n> > -'git fmt-merge-msg' [--log | --no-log] <$GIT_DIR/FETCH_HEAD\n> > -'git fmt-merge-msg' [--log | --no-log] -F <file>\n> > +'git fmt-merge-msg' [--log | --no-log] [--log-limit=<n>] <$GIT_DIR/FETCH_HEAD\n> > +'git fmt-merge-msg' [--log | --no-log] [--log-limit=<n>] -F <file>\n> \n> Do we need --log-limit? Why not just --log=42 and --no-log equals --log=0?\n> \n> Ditto for the config option:\n> \n>   merge.log=42\n>   merge.log=0\n\nAh, just when I was about to post the series. Excellent idea! I'll\ndrop Jonathan's patch and fixup the series to do this in a few\nminutes.\n\n> and for backwards compatibility:\n> \n>   merge.log=false  ===  merge.log=0\n>   merge.log=true   ===  merge.log=20\n\nI'll use git_config_bool_or_int for this -- we've traded off the\nability to say \"infinite\" though.\n\n-- Ram\n"},{"id":"148518","messageId":"4C6E4B16.2060308@viscovery.net","threadId":"24797","inReplyTo":"20100820091925.GE12794@kytes","subject":"Re: wishlist bugreport: make limit configurable for do_fmt_merge_msg (merge.log)","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-08-20T09:29:58Z","receivedAt":"2010-08-20T09:29:58Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 8/20/2010 11:19, schrieb Ramkumar Ramachandra:\n> I'll use git_config_bool_or_int for this -- we've traded off the\n> ability to say \"infinite\" though.\n\nI don't miss it. But can we still write in the config file\n\n  [merge]\n     log\n\nas a short-hand for\n\n  [merge]\n     log = true\n\n? If *that* were not possible anymore, it would be a regression.\n\n-- Hannes\n"}]}