{"thread":{"id":"24817","subject":"[PATCH v4 0/5] fmt-merge-msg improvements","startedAt":"2010-08-21T09:58:14Z","lastAt":"2010-08-22T06:53:34Z","messageCount":9,"participants":["Ramkumar Ramachandra","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":4,"patchTotal":5},"messages":[{"id":"148655","messageId":"1282384699-16477-1-git-send-email-artagnon@gmail.com","threadId":"24817","inReplyTo":null,"subject":"[PATCH v4 0/5] fmt-merge-msg improvements","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T09:58:14Z","receivedAt":"2010-08-21T09:58:14Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"This version uses PARSE_OPT_OPTARG instead of PARSE_OPT_NOOPT. Also,\nthere are a few minor fixes from Jonathan's reviews.\n\nJunio: If the --summary shouldn't be removed before 1.8.0, feel free\nto drop PATCH 4/5 for now. I've made it independent of the other\npatches in this round.\n\nJonathan Nieder (1):\n  parse-options: clarify PARSE_OPT_NOARG description\n\nRamkumar Ramachandra (4):\n  fmt-merge-msg: Make the number of log entries in commit message\n    configurable\n  fmt-merge-msg: Update command line options to sync with config\n    options\n  fmt-merge-msg: Update fmt-merge-msg and merge-config documentation\n  fmt-merge-msg: Remove deprecated --summary option\n\n Documentation/git-fmt-merge-msg.txt |   24 +++++++------------\n Documentation/merge-config.txt      |    8 ++++-\n builtin/fmt-merge-msg.c             |   44 ++++++++++++++++------------------\n parse-options.h                     |    2 +-\n 4 files changed, 37 insertions(+), 41 deletions(-)\n\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148657","messageId":"1282384699-16477-2-git-send-email-artagnon@gmail.com","threadId":"24817","inReplyTo":"1282384699-16477-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T09:58:15Z","receivedAt":"2010-08-21T09:58:15Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Make the `merge.log` option either an integer or boolean instead of\njust a boolean. The integer can be used to specify how many merged\ncommits to summarize (at maximum) in the merge message. Let true mean\n20. Default to false.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nReported-by: Yaroslav Halchenko <debian <at> onerussian.com>\nThanks-to: Johannes Sixt <j.sixt <at> viscovery.net>\nThanks-to: Jonathan Nieder <jrnieder <at> gmail.com>\n---\n builtin/fmt-merge-msg.c |   23 +++++++++++++++--------\n 1 files changed, 15 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex e7e12ee..66b1cbd 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -12,16 +12,23 @@ static const char * const fmt_merge_msg_usage[] = {\n };\n \n static int merge_summary;\n+static int log_limit = 0;\n \n static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n {\n \tstatic int found_merge_log = 0;\n+\tint is_bool;\n \tif (!strcmp(\"merge.log\", key)) {\n \t\tfound_merge_log = 1;\n-\t\tmerge_summary = git_config_bool(key, value);\n+\t\tlog_limit = git_config_bool_or_int(key, value, &is_bool);\n \t}\n \tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n-\t\tmerge_summary = git_config_bool(key, value);\n+\t\tlog_limit = git_config_bool_or_int(key, value, &is_bool);\n+\n+\tif (is_bool && log_limit)\n+\t\tlog_limit = 20;\n+\tmerge_summary = log_limit ? 1 : 0;\n+\n \treturn 0;\n }\n \n@@ -140,7 +147,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 +176,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 +189,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 +264,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 +310,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-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148656","messageId":"1282384699-16477-3-git-send-email-artagnon@gmail.com","threadId":"24817","inReplyTo":"1282384699-16477-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 2/5] fmt-merge-msg: Update command line options to sync with config options","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T09:58:16Z","receivedAt":"2010-08-21T09:58:16Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Update the `--log` and `--summary` command line options to be integers\nand have the same effect as the `merge.log` and `merge.summary`\nconfiguration options.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nCc: Johannes Sixt <j.sixt <at> viscovery.net>\nCc: Jonathan Nieder <jrnieder <at> gmail.com>\n---\n builtin/fmt-merge-msg.c |   24 ++++++++++++------------\n 1 files changed, 12 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 66b1cbd..cad9ed4 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -7,11 +7,10 @@\n #include \"string-list.h\"\n \n static const char * const fmt_merge_msg_usage[] = {\n-\t\"git fmt-merge-msg [-m <message>] [--log|--no-log] [--file <file>]\",\n+\t\"git fmt-merge-msg [-m <message>] [--log[=<n>]|--no-log] [--file <file>]\",\n \tNULL\n };\n \n-static int merge_summary;\n static int log_limit = 0;\n \n static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n@@ -27,7 +26,6 @@ static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n \n \tif (is_bool && log_limit)\n \t\tlog_limit = 20;\n-\tmerge_summary = log_limit ? 1 : 0;\n \n \treturn 0;\n }\n@@ -262,7 +260,7 @@ static void do_fmt_merge_msg_title(struct strbuf *out,\n \t\tstrbuf_addf(out, \" into %s\\n\", current_branch);\n }\n \n-static int do_fmt_merge_msg(int merge_title, int merge_summary,\n+static int do_fmt_merge_msg(int merge_title, int log_limit,\n \tstruct strbuf *in, struct strbuf *out) {\n \tint i = 0, pos = 0;\n \tunsigned char head_sha1[20];\n@@ -295,7 +293,7 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,\n \tif (merge_title)\n \t\tdo_fmt_merge_msg_title(out, current_branch);\n \n-\tif (merge_summary) {\n+\tif (log_limit) {\n \t\tstruct commit *head;\n \t\tstruct rev_info rev;\n \n@@ -315,8 +313,8 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,\n \treturn 0;\n }\n \n-int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {\n-\treturn do_fmt_merge_msg(1, merge_summary, in, out);\n+int fmt_merge_msg(int log_limit, struct strbuf *in, struct strbuf *out) {\n+\treturn do_fmt_merge_msg(1, log_limit, in, out);\n }\n \n int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {\n@@ -328,10 +326,12 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \tconst char *inpath = NULL;\n \tconst char *message = NULL;\n \tstruct option options[] = {\n-\t\tOPT_BOOLEAN(0, \"log\",     &merge_summary, \"populate log with the shortlog\"),\n-\t\t{ OPTION_BOOLEAN, 0, \"summary\", &merge_summary, NULL,\n+\t\t{ OPTION_INTEGER, 0, \"log\", &log_limit, \"n\",\n+\t\t  \"populate log with <n> entries from shortlog\",\n+\t\t  PARSE_OPT_OPTARG, NULL, 20 },\n+\t\t{ OPTION_INTEGER, 0, \"summary\", &log_limit, \"n\",\n \t\t  \"alias for --log (deprecated)\",\n-\t\t  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },\n+\t\t  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },\n \t\tOPT_STRING('m', \"message\", &message, \"text\",\n \t\t\t\"use <text> as start of message\"),\n \t\tOPT_FILENAME('F', \"file\", &inpath, \"file to read from\"),\n@@ -347,7 +347,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\t\t     0);\n \tif (argc > 0)\n \t\tusage_with_options(fmt_merge_msg_usage, options);\n-\tif (message && !merge_summary) {\n+\tif (message && !log_limit) {\n \t\tchar nl = '\\n';\n \t\twrite_in_full(STDOUT_FILENO, message, strlen(message));\n \t\twrite_in_full(STDOUT_FILENO, &nl, 1);\n@@ -366,7 +366,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\tstrbuf_addstr(&output, message);\n \t\tret = fmt_merge_msg_shortlog(&input, &output);\n \t} else {\n-\t\tret = fmt_merge_msg(merge_summary, &input, &output);\n+\t\tret = fmt_merge_msg(log_limit, &input, &output);\n \t}\n \tif (ret)\n \t\treturn ret;\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148659","messageId":"1282384699-16477-4-git-send-email-artagnon@gmail.com","threadId":"24817","inReplyTo":"1282384699-16477-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 3/5] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T09:58:17Z","receivedAt":"2010-08-21T09:58:17Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Update the documentation of fmt-merge-msg and merge-config to reflect\nthe fact that `merge.log` can either be a boolean or integer option\nnow, instead of just a boolean.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nCc: Johannes Sixt <j.sixt <at> viscovery.net>\nCc: Jonathan Nieder <jrnieder <at> gmail.com>\n---\n Documentation/git-fmt-merge-msg.txt |   15 +++++++++------\n Documentation/merge-config.txt      |    8 ++++++--\n 2 files changed, 15 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex 302f56b..9499322 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' [-m <message>] [--log | --no-log] <$GIT_DIR/FETCH_HEAD\n-'git fmt-merge-msg' [-m <message>] [--log | --no-log] -F <file>\n+'git fmt-merge-msg' [-m <message>] [--[no-]log[=<n>]] < $GIT_DIR/FETCH_HEAD\n+'git fmt-merge-msg' [-m <message>] [--[no-]log[=<n>]] -F <file>\n \n DESCRIPTION\n -----------\n@@ -24,10 +24,10 @@ automatically invoking 'git merge'.\n OPTIONS\n -------\n \n---log::\n+--log[=<n>]::\n \tIn addition to branch names, populate the log message with\n-\tone-line descriptions from the actual commits that are being\n-\tmerged.\n+\tone-line descriptions from at most <n> actual commits that are\n+\tbeing merged. If omitted, <n> defaults to 20.\n \n --no-log::\n \tDo not list one-line descriptions from the actual commits being\n@@ -53,7 +53,10 @@ CONFIGURATION\n \n merge.log::\n \tWhether to include summaries of merged commits in newly\n-\tmerge commit messages. False by default.\n+\tcreated merge commit messages.  Optionally, an integer can be\n+\tused to specify how many merged commits to summarize (at\n+\tmaxmium) in the merge message. Specifying \"true\" is equivalent\n+\tto specifying 20. Defaults to false.\n \n merge.summary::\n \tSynonym to `merge.log`; this is deprecated and will be removed in\ndiff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt\nindex b72f533..f63f7cb 100644\n--- a/Documentation/merge-config.txt\n+++ b/Documentation/merge-config.txt\n@@ -7,8 +7,12 @@ merge.conflictstyle::\n \tmarker and the original text before the `=======` marker.\n \n merge.log::\n-\tWhether to include summaries of merged commits in newly created\n-\tmerge commit messages. False by default.\n+\tWhether to include summaries of merged commits in newly\n+\tcreated merge commit messages.  Optionally, an integer can be\n+\tused to specify how many merged commits to summarize (at\n+\tmaxmium) in the merge message. Specifying \"true\" is equivalent\n+\tto specifying 20.  Defaults to false. 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-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148660","messageId":"1282384699-16477-5-git-send-email-artagnon@gmail.com","threadId":"24817","inReplyTo":"1282384699-16477-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 4/5] fmt-merge-msg: Remove deprecated --summary option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T09:58:18Z","receivedAt":"2010-08-21T09:58:18Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Remove the deprecated --summary option that served as a syonym to the\n--log option.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n Documentation/git-fmt-merge-msg.txt |    9 ---------\n builtin/fmt-merge-msg.c             |   13 ++-----------\n 2 files changed, 2 insertions(+), 20 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex 9499322..5a5c318 100644\n--- a/Documentation/git-fmt-merge-msg.txt\n+++ b/Documentation/git-fmt-merge-msg.txt\n@@ -33,11 +33,6 @@ OPTIONS\n \tDo not list one-line descriptions from the actual commits being\n \tmerged.\n \n---summary::\n---no-summary::\n-\tSynonyms to --log and --no-log; these are deprecated and will be\n-\tremoved in the future.\n-\n -m <message>::\n --message <message>::\n \tUse <message> instead of the branch names for the first line\n@@ -58,10 +53,6 @@ merge.log::\n \tmaxmium) in the merge message. Specifying \"true\" is equivalent\n \tto specifying 20. Defaults to false.\n \n-merge.summary::\n-\tSynonym to `merge.log`; this is deprecated and will be removed in\n-\tthe future.\n-\n SEE ALSO\n --------\n linkgit:git-merge[1]\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex cad9ed4..1e969f2 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -15,18 +15,12 @@ static int log_limit = 0;\n \n static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n {\n-\tstatic int found_merge_log = 0;\n \tint is_bool;\n \tif (!strcmp(\"merge.log\", key)) {\n-\t\tfound_merge_log = 1;\n \t\tlog_limit = git_config_bool_or_int(key, value, &is_bool);\n+\t\tif (is_bool && log_limit)\n+\t\t\tlog_limit = 20;\n \t}\n-\tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n-\t\tlog_limit = git_config_bool_or_int(key, value, &is_bool);\n-\n-\tif (is_bool && log_limit)\n-\t\tlog_limit = 20;\n-\n \treturn 0;\n }\n \n@@ -329,9 +323,6 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\t{ OPTION_INTEGER, 0, \"log\", &log_limit, \"n\",\n \t\t  \"populate log with <n> entries from shortlog\",\n \t\t  PARSE_OPT_OPTARG, NULL, 20 },\n-\t\t{ OPTION_INTEGER, 0, \"summary\", &log_limit, \"n\",\n-\t\t  \"alias for --log (deprecated)\",\n-\t\t  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },\n \t\tOPT_STRING('m', \"message\", &message, \"text\",\n \t\t\t\"use <text> as start of message\"),\n \t\tOPT_FILENAME('F', \"file\", &inpath, \"file to read from\"),\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148658","messageId":"1282384699-16477-6-git-send-email-artagnon@gmail.com","threadId":"24817","inReplyTo":"1282384699-16477-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 5/5] parse-options: clarify PARSE_OPT_NOARG description","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-21T09:58:19Z","receivedAt":"2010-08-21T09:58:19Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"From: Jonathan Nieder <jrnieder@gmail.com>\n\nHere \"takes no argument\" means \"does not take an argument\".  The\nlatter phrasing might make it clearer that PARSE_OPT_NOARG does not\nmake an option with an argument that can optionally be left off.\n\nNoticed-by: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n parse-options.h |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/parse-options.h b/parse-options.h\nindex d3b1932..f5ee3a0 100644\n--- a/parse-options.h\n+++ b/parse-options.h\n@@ -69,7 +69,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);\n  * `flags`::\n  *   mask of parse_opt_option_flags.\n  *   PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs)\n- *   PARSE_OPT_NOARG: says that this option takes no argument\n+ *   PARSE_OPT_NOARG: says that this option does not take an argument\n  *   PARSE_OPT_NONEG: says that this option cannot be negated\n  *   PARSE_OPT_HIDDEN: this option is skipped in the default usage, and\n  *                     shown only in the full usage.\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148689","messageId":"20100822033330.GA12380@belmont.cs.uchicago.edu","threadId":"24817","inReplyTo":"1282384699-16477-2-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-22T03:33:30Z","receivedAt":"2010-08-22T03:33:30Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi again,\n\nThanks for working on this.\n\nRamkumar Ramachandra wrote:\n\n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> Reported-by: Yaroslav Halchenko <debian <at> onerussian.com>\n\nLooks like some of the @ signs have been corrupted somehow.\n\n> +++ b/builtin/fmt-merge-msg.c\n> @@ -12,16 +12,23 @@ static const char * const fmt_merge_msg_usage[] = {\n>  };\n>  \n>  static int merge_summary;\n> +static int log_limit = 0;\n\nI still don't see why the merge_summary is needed...\n\n>  static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n[...]\n> +\tmerge_summary = log_limit ? 1 : 0;\n\n... since shouldn't it always be equal to log_limit ? 1 : 0?\n\n> @@ -140,7 +147,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\nThis adds to my confusion.  Suppose the statics have values\n\n\tmerge_summary = 0;\n\tlog_limit = 11;\n\nand I try\n\n\tfmt_merge_msg(5, &in, &out);\n\nWhat will happen?\n\nCurrently (before this patch) the rules are as follows:\n\n\t- the merge_summary parameter to fmt_merge_msg\n\t  alone decides whether a shortlog (of at most 20 items\n\t  per parent) is printed.\n\n\t  To outside users (think \"git merge\"), the static\n\t  merge_summary var is simply irrelevant.\n\n\t- the static merge_summary variable is used internally by \"git\n\t  fmt-merge-msg\" command-line and configuration parsing (with\n\t  command line winning in ties).\n\nand builtin/merge.c has its own separate code for parsing merge.*\nconfiguration.\n\nFWIW if I were writing it, I would make changes in something like this\norder:\n\n - Change fmt_merge_msg API to\n\n\tint fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n\t\t\t\tint shortlog_len);\n\n   where shortlog_len is 0 for no shortlog, 20 for a shortlog\n   with 20 items.  Update all callers (the changed function\n   signature makes it easy to find them).\n\n - Update merge --log and fmt-merge-msg --log options to take\n   an optional \"size of shortlog\" argument.\n\n - update [merge] log configuration to accept an integer\n   \"size of shortlog\" value.\n\nThe first step might look like this.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n builtin.h               |    4 ++--\n builtin/fmt-merge-msg.c |   18 +++++++++---------\n builtin/merge.c         |    3 ++-\n 3 files changed, 13 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin.h b/builtin.h\nindex ed6ee26..a7352df 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -14,8 +14,8 @@ extern const char git_more_info_string[];\n extern void list_common_cmds_help(void);\n extern const char *help_unknown_cmd(const char *cmd);\n extern void prune_packed_objects(int);\n-extern int fmt_merge_msg(int merge_summary, struct strbuf *in,\n-\tstruct strbuf *out);\n+extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n+\t\t\t int shortlog_len);\n extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);\n extern int commit_notes(struct notes_tree *t, const char *msg);\n \ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex a76cd4e..83692c1 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -255,9 +255,9 @@ static void do_fmt_merge_msg_title(struct strbuf *out,\n \t\tstrbuf_addf(out, \" into %s\\n\", current_branch);\n }\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+static int do_fmt_merge_msg(int merge_title,\n+\tstruct strbuf *in, struct strbuf *out, int shortlog_len) {\n+\tint i = 0, pos = 0;\n \tunsigned char head_sha1[20];\n \tconst char *current_branch;\n \n@@ -288,7 +288,7 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,\n \tif (merge_title)\n \t\tdo_fmt_merge_msg_title(out, current_branch);\n \n-\tif (merge_summary) {\n+\tif (shortlog_len) {\n \t\tstruct commit *head;\n \t\tstruct rev_info rev;\n \n@@ -303,17 +303,17 @@ 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, shortlog_len, out);\n \t}\n \treturn 0;\n }\n \n-int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {\n-\treturn do_fmt_merge_msg(1, merge_summary, in, out);\n+int fmt_merge_msg(struct strbuf *in, struct strbuf *out, int shortlog_len) {\n+\treturn do_fmt_merge_msg(1, in, out, shortlog_len);\n }\n \n int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {\n-\treturn do_fmt_merge_msg(0, 1, in, out);\n+\treturn do_fmt_merge_msg(0, in, out, 20);\n }\n \n int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n@@ -346,7 +346,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \n \tif (strbuf_read(&input, fileno(in), 0) < 0)\n \t\tdie_errno(\"could not read input file\");\n-\tret = fmt_merge_msg(merge_summary, &input, &output);\n+\tret = fmt_merge_msg(&input, &output, merge_summary ? 20 : 0);\n \tif (ret)\n \t\treturn ret;\n \twrite_in_full(STDOUT_FILENO, output.buf, output.len);\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 37ce4f5..8b0b2e2 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1001,7 +1001,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\tif (have_message && option_log)\n \t\t\tfmt_merge_msg_shortlog(&merge_names, &merge_msg);\n \t\telse if (!have_message)\n-\t\t\tfmt_merge_msg(option_log, &merge_names, &merge_msg);\n+\t\t\tfmt_merge_msg(&merge_names, &merge_msg,\n+\t\t\t\t\toption_log ? 20 : 0);\n \n \n \t\tif (!(have_message && !option_log) && merge_msg.len)\n-- \n"},{"id":"148690","messageId":"7vfwy78cfl.fsf@alter.siamese.dyndns.org","threadId":"24817","inReplyTo":"20100822033330.GA12380@belmont.cs.uchicago.edu","subject":"Re: [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-22T05:05:18Z","receivedAt":"2010-08-22T05:05:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> FWIW if I were writing it, I would make changes in something like this\n> order:\n>\n>  - Change fmt_merge_msg API to\n>\n> \tint fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n> \t\t\t\tint shortlog_len);\n>\n>    where shortlog_len is 0 for no shortlog, 20 for a shortlog\n>    with 20 items.  Update all callers (the changed function\n>    signature makes it easy to find them).\n>\n>  - Update merge --log and fmt-merge-msg --log options to take\n>    an optional \"size of shortlog\" argument.\n>\n>  - update [merge] log configuration to accept an integer\n>    \"size of shortlog\" value.\n>\n> The first step might look like this.\n\nThanks; it is very pleasing to see a more experienced contributor\nmentoring another with a good example to show _how_ the design of a new\nfeature should be done.\n"},{"id":"148695","messageId":"20100822065331.GA15561@kytes","threadId":"24817","inReplyTo":"20100822033330.GA12380@belmont.cs.uchicago.edu","subject":"Re: [PATCH v4 1/5] fmt-merge-msg: Make the number of log entries in commit message configurable","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-22T06:53:34Z","receivedAt":"2010-08-22T06:53:34Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Jonathan,\n\nJonathan Nieder writes:\n> Hi again,\n> \n> Thanks for working on this.\n> \n> Ramkumar Ramachandra wrote:\n> \n> > Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> > Reported-by: Yaroslav Halchenko <debian <at> onerussian.com>\n> \n> Looks like some of the @ signs have been corrupted somehow.\n\nMy stupidity- I copied the additional lines off the GMane interface.\n\n[...]\n> FWIW if I were writing it, I would make changes in something like this\n> order:\n> \n>  - Change fmt_merge_msg API to\n> \n> \tint fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n> \t\t\t\tint shortlog_len);\n> \n>    where shortlog_len is 0 for no shortlog, 20 for a shortlog\n>    with 20 items.  Update all callers (the changed function\n>    signature makes it easy to find them).\n> \n>  - Update merge --log and fmt-merge-msg --log options to take\n>    an optional \"size of shortlog\" argument.\n> \n>  - update [merge] log configuration to accept an integer\n>    \"size of shortlog\" value.\n> \n> The first step might look like this.\n[...]\n\nThanks for being so patient! It looks like there's no end to my\nmistakes :p\n\nI'll rewrite this and try to follow the guidelines you've outlined in\nfuture- hopefully, I'll become more experienced someday :)\n\n-- Ram\n"}]}