{"thread":{"id":"24829","subject":"[PATCH v5 0/5] merge --log configurability","startedAt":"2010-08-22T16:26:33Z","lastAt":"2010-08-25T04:50:06Z","messageCount":13,"participants":["Ramkumar Ramachandra","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":5,"patchTotal":5},"messages":[{"id":"148709","messageId":"1282494398-20542-1-git-send-email-artagnon@gmail.com","threadId":"24829","inReplyTo":null,"subject":"[PATCH v5 0/5] merge --log configurability","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-22T16:26:33Z","receivedAt":"2010-08-22T16:26:33Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"This series is a complete rewrite after Jonathan's last review. I've\ntried to pay close attention to detail and be as careful as possible-\nlet me know if I've missed something.\n\nThanks.\n\nJonathan Nieder (1):\n  parse-options: clarify PARSE_OPT_NOARG description\n\nRamkumar Ramachandra (4):\n  fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len\n  merge: Make '--log' an integer option for number of shortlog entries\n  merge: Make 'merge.log' an integer or boolean option\n  fmt-merge-msg: Remove deprecated '--summary' option\n\n Documentation/git-fmt-merge-msg.txt |   23 +++++----------\n Documentation/merge-config.txt      |    8 ++++-\n Documentation/merge-options.txt     |   11 ++-----\n builtin.h                           |    5 +--\n builtin/fmt-merge-msg.c             |   49 ++++++++++++++++------------------\n builtin/merge.c                     |   25 +++++++++++------\n parse-options.h                     |    2 +-\n 7 files changed, 59 insertions(+), 64 deletions(-)\n\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148713","messageId":"1282494398-20542-2-git-send-email-artagnon@gmail.com","threadId":"24829","inReplyTo":"1282494398-20542-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-22T16:26:34Z","receivedAt":"2010-08-22T16:26:34Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Update the API of the fmt_merge_msg function to replace the the\nmerge_summary argument with a new shortlog_len argument. Update the\ncallers track this change: when translating from merge_summary to\nshortlog_len, note that 0 means no shortlog and 20 is the default\n\"enabled\" value.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nThanks-to: Jonathan Nieder <jrnieder@gmail.com>\n---\n builtin.h               |    5 ++---\n builtin/fmt-merge-msg.c |   24 +++++++++++-------------\n builtin/merge.c         |    5 +++--\n 3 files changed, 16 insertions(+), 18 deletions(-)\n\ndiff --git a/builtin.h b/builtin.h\nindex 9c3d50b..1993166 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -14,9 +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_shortlog(struct strbuf *in, struct strbuf *out);\n+extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n+\t\t\t int merge_title, int shortlog_len);\n extern int commit_notes(struct notes_tree *t, const char *msg);\n \n struct notes_rewrite_cfg {\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex e7e12ee..4ed728a 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, struct strbuf *in,\n+\tstruct 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,14 @@ 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-}\n-\n-int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {\n-\treturn do_fmt_merge_msg(0, 1, in, out);\n+int fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n+\t\t  int merge_title, int shortlog_len) {\n+\treturn do_fmt_merge_msg(merge_title, in, out, shortlog_len);\n }\n \n int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n@@ -357,9 +354,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\tdie_errno(\"could not read input file\");\n \tif (message) {\n \t\tstrbuf_addstr(&output, message);\n-\t\tret = fmt_merge_msg_shortlog(&input, &output);\n+\t\tret = fmt_merge_msg(&input, &output, 0, 20);\n \t} else {\n-\t\tret = fmt_merge_msg(merge_summary, &input, &output);\n+\t\tret = fmt_merge_msg(&input, &output, 1,\n+\t\t\t\t    merge_summary ? 20 : 0);\n \t}\n \tif (ret)\n \t\treturn ret;\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 4e4ec89..d47f48f 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1014,9 +1014,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t\tmerge_name(argv[i], &merge_names);\n \n \t\tif (have_message && option_log)\n-\t\t\tfmt_merge_msg_shortlog(&merge_names, &merge_msg);\n+\t\t\tfmt_merge_msg(&merge_names, &merge_msg, 0, 20);\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, 1,\n+\t\t\t\t      option_log ? 20: 0);\n \n \n \t\tif (!(have_message && !option_log) && merge_msg.len)\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148710","messageId":"1282494398-20542-3-git-send-email-artagnon@gmail.com","threadId":"24829","inReplyTo":"1282494398-20542-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-22T16:26:35Z","receivedAt":"2010-08-22T16:26:35Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Change the command-line '--log' option from a boolean option to an\ninteger option, and parse the optional integer provided on the\ncommand-line into the 'shortlog_len' variable. Also update the\ndocumentation accordingly.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nReported-by: Yaroslav Halchenko <debian@onerussian.com>\nThanks-to: Jonathan Nieder <jrnieder@gmail.com>\nThanks-to: Johannes Sixt <j.sixt@viscovery.net>\n---\n Documentation/git-fmt-merge-msg.txt |   10 +++++-----\n Documentation/merge-options.txt     |    6 +++---\n builtin/fmt-merge-msg.c             |   25 ++++++++++++++-----------\n builtin/merge.c                     |   18 ++++++++++--------\n 4 files changed, 32 insertions(+), 27 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex 302f56b..14ac466 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>] [--log[=<n>] | --no-log] <$GIT_DIR/FETCH_HEAD\n+'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log] -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\ndiff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt\nindex 722d704..1083f19 100644\n--- a/Documentation/merge-options.txt\n+++ b/Documentation/merge-options.txt\n@@ -16,11 +16,11 @@ inspect and further tweak the merge result before committing.\n With --no-ff Generate a merge commit even if the merge\n resolved as a fast-forward.\n \n---log::\n+--log[=<n>]::\n --no-log::\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 <n> actual commits that are being\n+\tmerged. See also linkgit:git-fmt-merge-msg[1].\n +\n With --no-log do not list one-line descriptions from the\n actual commits being merged.\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 4ed728a..1c5da95 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -7,21 +7,21 @@\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 shortlog_len;\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 \tif (!strcmp(\"merge.log\", key)) {\n \t\tfound_merge_log = 1;\n-\t\tmerge_summary = git_config_bool(key, value);\n+\t\tshortlog_len = git_config_bool(key, value);\n \t}\n \tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n-\t\tmerge_summary = git_config_bool(key, value);\n+\t\tshortlog_len = git_config_bool(key, value);\n \treturn 0;\n }\n \n@@ -318,10 +318,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  \"alias for --log (deprecated)\",\n-\t\t  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },\n+\t\t{ OPTION_INTEGER, 0, \"log\", &shortlog_len, \"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\", &shortlog_len, \"n\",\n+                  \"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@@ -337,7 +339,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 && !shortlog_len) {\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@@ -354,10 +356,11 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\tdie_errno(\"could not read input file\");\n \tif (message) {\n \t\tstrbuf_addstr(&output, message);\n-\t\tret = fmt_merge_msg(&input, &output, 0, 20);\n+\t\tret = fmt_merge_msg(&input, &output, 0,\n+\t\t\t\t    shortlog_len);\n \t} else {\n \t\tret = fmt_merge_msg(&input, &output, 1,\n-\t\t\t\t    merge_summary ? 20 : 0);\n+\t\t\t\t    shortlog_len);\n \t}\n \tif (ret)\n \t\treturn ret;\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex d47f48f..994b0c5 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -42,7 +42,7 @@ static const char * const builtin_merge_usage[] = {\n \tNULL\n };\n \n-static int show_diffstat = 1, option_log, squash;\n+static int show_diffstat = 1, shortlog_len, squash;\n static int option_commit = 1, allow_fast_forward = 1;\n static int fast_forward_only;\n static int allow_trivial = 1, have_message;\n@@ -177,8 +177,9 @@ static struct option builtin_merge_options[] = {\n \tOPT_BOOLEAN(0, \"stat\", &show_diffstat,\n \t\t\"show a diffstat at the end of the merge\"),\n \tOPT_BOOLEAN(0, \"summary\", &show_diffstat, \"(synonym to --stat)\"),\n-\tOPT_BOOLEAN(0, \"log\", &option_log,\n-\t\t\"add list of one-line log to merge commit message\"),\n+\t{ OPTION_INTEGER, 0, \"log\", &shortlog_len, \"n\",\n+\t  \"populate log with <n> entries from shortlog\",\n+\t  PARSE_OPT_OPTARG, NULL, 20 },\n \tOPT_BOOLEAN(0, \"squash\", &squash,\n \t\t\"create a single commit instead of doing a merge\"),\n \tOPT_BOOLEAN(0, \"commit\", &option_commit,\n@@ -505,7 +506,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)\n \telse if (!strcmp(k, \"pull.octopus\"))\n \t\treturn git_config_string(&pull_octopus, k, v);\n \telse if (!strcmp(k, \"merge.log\") || !strcmp(k, \"merge.summary\"))\n-\t\toption_log = git_config_bool(k, v);\n+\t\tshortlog_len = git_config_bool(k, v);\n \telse if (!strcmp(k, \"merge.renormalize\"))\n \t\toption_renormalize = git_config_bool(k, v);\n \treturn git_diff_ui_config(k, v, cb);\n@@ -1013,14 +1014,15 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\tfor (i = 0; i < argc; i++)\n \t\t\tmerge_name(argv[i], &merge_names);\n \n-\t\tif (have_message && option_log)\n-\t\t\tfmt_merge_msg(&merge_names, &merge_msg, 0, 20);\n+\t\tif (have_message && shortlog_len)\n+\t\t\tfmt_merge_msg(&merge_names, &merge_msg, 0,\n+\t\t\t\t      shortlog_len);\n \t\telse if (!have_message)\n \t\t\tfmt_merge_msg(&merge_names, &merge_msg, 1,\n-\t\t\t\t      option_log ? 20: 0);\n+\t\t\t\t      shortlog_len);\n \n \n-\t\tif (!(have_message && !option_log) && merge_msg.len)\n+\t\tif (!(have_message && !shortlog_len) && merge_msg.len)\n \t\t\tstrbuf_setlen(&merge_msg, merge_msg.len-1);\n \t}\n \n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148714","messageId":"1282494398-20542-4-git-send-email-artagnon@gmail.com","threadId":"24829","inReplyTo":"1282494398-20542-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-22T16:26:36Z","receivedAt":"2010-08-22T16:26:36Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Make 'merge.log' an integer or boolean option to set the number of\nshortlog entries to display in the merge commit. Note that it defaults\nto false, and that true means a default value of 20. Also update\ncorresponding documentation.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nThanks-to: Jonathan Nieder <jrnieder@gmail.com>\nThanks-to: Johannes Sixt <j.sixt@viscovery.net>\n---\n Documentation/git-fmt-merge-msg.txt |    8 +++++---\n Documentation/merge-config.txt      |    8 ++++++--\n builtin/fmt-merge-msg.c             |   11 +++++------\n builtin/merge.c                     |    8 ++++++--\n 4 files changed, 22 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex 14ac466..5954a53 100644\n--- a/Documentation/git-fmt-merge-msg.txt\n+++ b/Documentation/git-fmt-merge-msg.txt\n@@ -25,9 +25,11 @@ OPTIONS\n -------\n \n --log[=<n>]::\n-\tIn addition to branch names, populate the log message with\n-\tone-line descriptions from at most <n> actual commits that are\n-\tbeing merged. If omitted, <n> defaults to 20.\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\n+\tequivalent to specifying 20.  Defaults to false.\n \n --no-log::\n \tDo not list one-line descriptions from the actual commits being\ndiff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt\nindex b72f533..510c0ad 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\n+\tequivalent to 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\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 1c5da95..6a2c9c8 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -15,13 +15,12 @@ static int shortlog_len;\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-\tif (!strcmp(\"merge.log\", key)) {\n-\t\tfound_merge_log = 1;\n-\t\tshortlog_len = git_config_bool(key, value);\n+\tif (!strcmp(key, \"merge.log\") || !strcmp(key, \"merge.summary\")) {\n+\t\tint is_bool;\n+\t\tshortlog_len = git_config_bool_or_int(key, value, &is_bool);\n+\t\tif (is_bool && shortlog_len)\n+\t\t\tshortlog_len = 20;\n \t}\n-\tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n-\t\tshortlog_len = git_config_bool(key, value);\n \treturn 0;\n }\n \ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 994b0c5..78d6c69 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -505,8 +505,12 @@ static int git_merge_config(const char *k, const char *v, void *cb)\n \t\treturn git_config_string(&pull_twohead, k, v);\n \telse if (!strcmp(k, \"pull.octopus\"))\n \t\treturn git_config_string(&pull_octopus, k, v);\n-\telse if (!strcmp(k, \"merge.log\") || !strcmp(k, \"merge.summary\"))\n-\t\tshortlog_len = git_config_bool(k, v);\n+\telse if (!strcmp(k, \"merge.log\") || !strcmp(k, \"merge.summary\")) {\n+\t\tint is_bool;\n+\t\tshortlog_len = git_config_bool_or_int(k, v, &is_bool);\n+\t\tif (is_bool && shortlog_len)\n+\t\t\tshortlog_len = 20;\n+\t}\n \telse if (!strcmp(k, \"merge.renormalize\"))\n \t\toption_renormalize = git_config_bool(k, v);\n \treturn git_diff_ui_config(k, v, cb);\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148711","messageId":"1282494398-20542-5-git-send-email-artagnon@gmail.com","threadId":"24829","inReplyTo":"1282494398-20542-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v5 4/5] fmt-merge-msg: Remove deprecated '--summary' option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-22T16:26:37Z","receivedAt":"2010-08-22T16:26:37Z","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\nthe '--log' option. Also update the documentation accordingly.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n Documentation/git-fmt-merge-msg.txt |    9 ---------\n Documentation/merge-options.txt     |    5 -----\n builtin/fmt-merge-msg.c             |    5 +----\n builtin/merge.c                     |    2 +-\n 4 files changed, 2 insertions(+), 19 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex 5954a53..a0eb7e2 100644\n--- a/Documentation/git-fmt-merge-msg.txt\n+++ b/Documentation/git-fmt-merge-msg.txt\n@@ -35,11 +35,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@@ -57,10 +52,6 @@ merge.log::\n \tWhether to include summaries of merged commits in newly\n \tmerge commit messages. False by default.\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/Documentation/merge-options.txt b/Documentation/merge-options.txt\nindex 1083f19..8001005 100644\n--- a/Documentation/merge-options.txt\n+++ b/Documentation/merge-options.txt\n@@ -67,11 +67,6 @@ option can be used to override --squash.\n \tPass merge strategy specific option through to the merge\n \tstrategy.\n \n---summary::\n---no-summary::\n-\tSynonyms to --stat and --no-stat; these are deprecated and will be\n-\tremoved in the future.\n-\n ifndef::git-pull[]\n -q::\n --quiet::\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 6a2c9c8..4255890 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -15,7 +15,7 @@ static int shortlog_len;\n \n static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\n {\n-\tif (!strcmp(key, \"merge.log\") || !strcmp(key, \"merge.summary\")) {\n+\tif (!strcmp(key, \"merge.log\")) {\n \t\tint is_bool;\n \t\tshortlog_len = git_config_bool_or_int(key, value, &is_bool);\n \t\tif (is_bool && shortlog_len)\n@@ -320,9 +320,6 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\t{ OPTION_INTEGER, 0, \"log\", &shortlog_len, \"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\", &shortlog_len, \"n\",\n-                  \"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\"),\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 78d6c69..9196428 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -505,7 +505,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)\n \t\treturn git_config_string(&pull_twohead, k, v);\n \telse if (!strcmp(k, \"pull.octopus\"))\n \t\treturn git_config_string(&pull_octopus, k, v);\n-\telse if (!strcmp(k, \"merge.log\") || !strcmp(k, \"merge.summary\")) {\n+\telse if (!strcmp(k, \"merge.log\")) {\n \t\tint is_bool;\n \t\tshortlog_len = git_config_bool_or_int(k, v, &is_bool);\n \t\tif (is_bool && shortlog_len)\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"148712","messageId":"1282494398-20542-6-git-send-email-artagnon@gmail.com","threadId":"24829","inReplyTo":"1282494398-20542-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v5 5/5] parse-options: clarify PARSE_OPT_NOARG description","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-22T16:26:38Z","receivedAt":"2010-08-22T16:26:38Z","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":"148789","messageId":"20100823220031.GA1308@burratino","threadId":"24829","inReplyTo":"1282494398-20542-2-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-23T22:00:31Z","receivedAt":"2010-08-23T22:00:31Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ramkumar Ramachandra wrote:\n\n> Update the API of the fmt_merge_msg function to replace the the\n> merge_summary argument with a new shortlog_len argument.\n\nEven more, actually:\n\n> +++ b/builtin.h\n> @@ -14,9 +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_shortlog(struct strbuf *in, struct strbuf *out);\n> +extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n> +\t\t\t int merge_title, int shortlog_len);\n\nThis combines the public functions.  Nice, but probably worth a\nmention in the log message.\n\nThe API does not make the sense of the merge_title argument clear:\nshould it be 1 when the caller provides a title or when fmt_merge_msg\nshould provide one?  There is not much I can see to do about that;\nI'd just suggest making it clear in the commit message (so it can\nbe mentioned in the API docs, once they're written :)).\n\n> @@ -357,9 +354,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n>  \t\tdie_errno(\"could not read input file\");\n>  \tif (message) {\n>  \t\tstrbuf_addstr(&output, message);\n> -\t\tret = fmt_merge_msg_shortlog(&input, &output);\n> +\t\tret = fmt_merge_msg(&input, &output, 0, 20);\n>  \t} else {\n> -\t\tret = fmt_merge_msg(merge_summary, &input, &output);\n> +\t\tret = fmt_merge_msg(&input, &output, 1,\n> +\t\t\t\t    merge_summary ? 20 : 0);\n\nCould be further simplified:\n\n\tif (message)\n\t\tstrbuf_addstr(&output, message);\n\tret = fmt_merge_msg(&input, &output,\n\t\t\t\tmessage ? 0 : 1,\n\t\t\t\tmerge_summary ? 20 : 0);\n\nNot sure if that helps or not.\n\nA part of me wishes that the constant 20 wouldn't be duplicated so much.\nWould something like\n\n\t#define DEFAULT_MERGE_SHORTLOG_LEN 20\n\nmake sense?\n\n> +++ b/builtin/merge.c\n> @@ -1014,9 +1014,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n>  \t\t\tmerge_name(argv[i], &merge_names);\n>  \n>  \t\tif (have_message && option_log)\n> -\t\t\tfmt_merge_msg_shortlog(&merge_names, &merge_msg);\n> +\t\t\tfmt_merge_msg(&merge_names, &merge_msg, 0, 20);\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, 1,\n> +\t\t\t\t      option_log ? 20: 0);\n\nLikewise.\n\nThe rest looks good.  So except for the commit message,\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.\n\nHere are the cleanups I mentioned.  Except for the #define, they\nprobably don't belong in this patch.\n---\ndiff --git a/builtin.h b/builtin.h\nindex 7d18106..09b94ea 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -7,6 +7,8 @@\n #include \"commit.h\"\n #include \"notes.h\"\n \n+#define DEFAULT_MERGE_LOG_LEN 20\n+\n extern const char git_version_string[];\n extern const char git_usage_string[];\n extern const char git_more_info_string[];\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 4ed728a..7f06b95 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -352,13 +352,13 @@ 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-\tif (message) {\n+\n+\tif (message)\n \t\tstrbuf_addstr(&output, message);\n-\t\tret = fmt_merge_msg(&input, &output, 0, 20);\n-\t} else {\n-\t\tret = fmt_merge_msg(&input, &output, 1,\n-\t\t\t\t    merge_summary ? 20 : 0);\n-\t}\n+\tret = fmt_merge_msg(&input, &output,\n+\t\t\t    message ? 0 : 1,\n+\t\t\t    merge_summary ? DEFAULT_MERGE_LOG_LEN : 0);\n+\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 70ee412..d797853 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1000,15 +1000,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\tfor (i = 0; i < argc; i++)\n \t\t\tmerge_name(argv[i], &merge_names);\n \n-\t\tif (have_message && option_log)\n-\t\t\tfmt_merge_msg(&merge_names, &merge_msg, 0, 20);\n-\t\telse if (!have_message)\n-\t\t\tfmt_merge_msg(&merge_names, &merge_msg, 1,\n-\t\t\t\t      option_log ? 20: 0);\n-\n-\n-\t\tif (!(have_message && !option_log) && merge_msg.len)\n-\t\t\tstrbuf_setlen(&merge_msg, merge_msg.len-1);\n+\t\tif (!have_message || option_log) {\n+\t\t\tfmt_merge_msg(&merge_names, &merge_msg, !have_message,\n+\t\t\t\t      option_log ? DEFAULT_MERGE_LOG_LEN : 0);\n+\t\t\tif (merge_msg.len)\n+\t\t\t\tstrbuf_setlen(&merge_msg, merge_msg.len - 1);\n+\t\t}\n \t}\n \n \tif (head_invalid || !argc)\n-- \n"},{"id":"148790","messageId":"20100823222542.GD1308@burratino","threadId":"24829","inReplyTo":"1282494398-20542-3-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-23T22:25:42Z","receivedAt":"2010-08-23T22:25:42Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ramkumar Ramachandra wrote:\n\n>  Documentation/git-fmt-merge-msg.txt |   10 +++++-----\n>  Documentation/merge-options.txt     |    6 +++---\n>  builtin/fmt-merge-msg.c             |   25 ++++++++++++++-----------\n>  builtin/merge.c                     |   18 ++++++++++--------\n>  4 files changed, 32 insertions(+), 27 deletions(-)\n\nIs this on top of \"next\"?  I had trouble applying it on top of the\nupdate-contrib-example-merge topic.\n\n> --- a/Documentation/git-fmt-merge-msg.txt\n> +++ b/Documentation/git-fmt-merge-msg.txt\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\nThe description feels a bit awkward.  Maybe:\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.  At most <n> commits from each merge parent will be\n\tused (20 if <n> is omitted).  This overrides the `merge.log`\n\tconfiguration variable.\n\n> +++ b/Documentation/merge-options.txt\n> @@ -16,11 +16,11 @@ inspect and further tweak the merge result before committing.\n>  With --no-ff Generate a merge commit even if the merge\n>  resolved as a fast-forward.\n>  \n> ---log::\n> +--log[=<n>]::\n>  --no-log::\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 <n> actual commits that are being\n> +\tmerged. See also linkgit:git-fmt-merge-msg[1].\n\nMaybe s/<n>/at most <n>/.\n\n> --- a/builtin/fmt-merge-msg.c\n> +++ b/builtin/fmt-merge-msg.c\n> @@ -7,21 +7,21 @@\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 shortlog_len;\n\nBefore: merge_summary is 1 for --log, 0 for --no-log.\nAfter: shortlog_len is 20 for --log, 0 for --no-log, right?\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>  \tif (!strcmp(\"merge.log\", key)) {\n>  \t\tfound_merge_log = 1;\n> -\t\tmerge_summary = git_config_bool(key, value);\n> +\t\tshortlog_len = git_config_bool(key, value);\n>  \t}\n>  \tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n> -\t\tmerge_summary = git_config_bool(key, value);\n> +\t\tshortlog_len = git_config_bool(key, value);\n\nSo should this say something like\n\n\tshortlog_len = git_config_bool(key, value) ?\n\t\t\t\tDEFAULT_MERGE_LOG_LEN : 0;\n\n?\n\n> @@ -318,10 +318,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  \"alias for --log (deprecated)\",\n> -\t\t  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },\n> +\t\t{ OPTION_INTEGER, 0, \"log\", &shortlog_len, \"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\", &shortlog_len, \"n\",\n> +                  \"alias for --log (deprecated)\",\n> +\t\t  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },\n\nWhitespace damage.\n\n> +++ b/builtin/merge.c\n> @@ -42,7 +42,7 @@ static const char * const builtin_merge_usage[] = {\n>  \tNULL\n>  };\n>  \n> -static int show_diffstat = 1, option_log, squash;\n> +static int show_diffstat = 1, shortlog_len, squash;\n>  static int option_commit = 1, allow_fast_forward = 1;\n>  static int fast_forward_only;\n>  static int allow_trivial = 1, have_message;\n> @@ -177,8 +177,9 @@ static struct option builtin_merge_options[] = {\n>  \tOPT_BOOLEAN(0, \"stat\", &show_diffstat,\n>  \t\t\"show a diffstat at the end of the merge\"),\n>  \tOPT_BOOLEAN(0, \"summary\", &show_diffstat, \"(synonym to --stat)\"),\n> -\tOPT_BOOLEAN(0, \"log\", &option_log,\n> -\t\t\"add list of one-line log to merge commit message\"),\n> +\t{ OPTION_INTEGER, 0, \"log\", &shortlog_len, \"n\",\n> +\t  \"populate log with <n> entries from shortlog\",\n\nThe emphasis seems wrong: the important thing is still that --log\nuses a shortlog, not the number of entries.  Maybe something like\n\n\t  \"populate log with (at most <n>) entries from shortlog\"\n\nbut that might make \"git merge -h\" use more than 80 columns...\n\n>  \tOPT_BOOLEAN(0, \"commit\", &option_commit,\n> @@ -505,7 +506,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)\n>  \telse if (!strcmp(k, \"pull.octopus\"))\n>  \t\treturn git_config_string(&pull_octopus, k, v);\n>  \telse if (!strcmp(k, \"merge.log\") || !strcmp(k, \"merge.summary\"))\n> -\t\toption_log = git_config_bool(k, v);\n> +\t\tshortlog_len = git_config_bool(k, v);\n\nAs before (is this missing a \" ? DEFAULT_MERGE_LOG_LEN : 0\"?).\n\nExcept as noted above,\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"148849","messageId":"7vzkwcvsm5.fsf@alter.siamese.dyndns.org","threadId":"24829","inReplyTo":"20100823220031.GA1308@burratino","subject":"Re: [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-24T17:16:18Z","receivedAt":"2010-08-24T17:16: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> The rest looks good.  So except for the commit message,\n>\n> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks; all of your comments make sense.  Here is what I'll queue.\n\n-- >8 --\nFrom: Ramkumar Ramachandra <artagnon@gmail.com>\nDate: Sun, 22 Aug 2010 21:56:34 +0530\nSubject: [PATCH] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len\n\nGive \"shortlog_len\" parameter to the fmt_merge_msg(), remove its\n\"merge_summary\" parameter, and remove fmt_merge_msg_shortlog() function.\nIn the updated API, shortlog_len == 0 means no shortlog is given.\n\nThe parameter \"merge_title\" controls if the title of the merge commit is\nautogenerated (it reads something like \"Merge branch ...\"), and typically\nit is set to true when the caller does not give its own message.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nHelped-and-Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin.h               |    7 ++++---\n builtin/fmt-merge-msg.c |   30 ++++++++++++++----------------\n builtin/merge.c         |   14 ++++++--------\n 3 files changed, 24 insertions(+), 27 deletions(-)\n\ndiff --git a/builtin.h b/builtin.h\nindex ed6ee26..09b94ea 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -7,6 +7,8 @@\n #include \"commit.h\"\n #include \"notes.h\"\n \n+#define DEFAULT_MERGE_LOG_LEN 20\n+\n extern const char git_version_string[];\n extern const char git_usage_string[];\n extern const char git_more_info_string[];\n@@ -14,9 +16,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_shortlog(struct strbuf *in, struct strbuf *out);\n+extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n+\t\t\t int merge_title, int shortlog_len);\n extern int commit_notes(struct notes_tree *t, const char *msg);\n \n struct notes_rewrite_cfg {\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 937d5a7..42021d3 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, struct strbuf *in,\n+\tstruct 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,14 @@ 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-}\n-\n-int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {\n-\treturn do_fmt_merge_msg(0, 1, in, out);\n+int fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n+\t\t  int merge_title, int shortlog_len) {\n+\treturn do_fmt_merge_msg(merge_title, in, out, shortlog_len);\n }\n \n int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n@@ -355,12 +352,13 @@ 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-\tif (message) {\n+\n+\tif (message)\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}\n+\tret = fmt_merge_msg(&input, &output,\n+\t\t\t    message ? 0 : 1,\n+\t\t\t    merge_summary ? DEFAULT_MERGE_LOG_LEN : 0);\n+\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 2207f79..b2c0984 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -998,14 +998,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\tfor (i = 0; i < argc; i++)\n \t\t\tmerge_name(argv[i], &merge_names);\n \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-\n-\n-\t\tif (!(have_message && !option_log) && merge_msg.len)\n-\t\t\tstrbuf_setlen(&merge_msg, merge_msg.len-1);\n+\t\tif (!have_message || option_log) {\n+\t\t\tfmt_merge_msg(&merge_names, &merge_msg, !have_message,\n+\t\t\t\t      option_log ? DEFAULT_MERGE_LOG_LEN : 0);\n+\t\t\tif (merge_msg.len)\n+\t\t\t\tstrbuf_setlen(&merge_msg, merge_msg.len - 1);\n+\t\t}\n \t}\n \n \tif (head_invalid || !argc)\n-- \n1.7.2.2.426.g2251a\n"},{"id":"148862","messageId":"7vmxsbu963.fsf@alter.siamese.dyndns.org","threadId":"24829","inReplyTo":"1282494398-20542-4-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-24T19:01:40Z","receivedAt":"2010-08-24T19:01:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This makes sense, but I agree with Jonathan's reviews on 1/5 and 2/5, I'll\nask you to reroll this on top of what I'll push out shortly.\n\nAs to 4/5, I think we should proceed a lot more carefully than what your\npatch does, just like we were extra careful when we went to v1.7.0 than\nwhen we went to v1.6.0 (see release notes to 1.6.6 for a summary,\nespecially paying attention to the third and the fourth paragraph in\n\"Preparing yourselves\" section).\n\nI've queued 5/5 directly on maint.\n\nThanks.\n"},{"id":"148917","messageId":"20100825024440.GD11619@burratino","threadId":"24829","inReplyTo":"7vzkwcvsm5.fsf@alter.siamese.dyndns.org","subject":"[PATCH rr/fmt-merge-msg] merge, fmt_merge_msg --log: default value is DEFAULT_MERGE_LOG_LEN","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-25T02:44:40Z","receivedAt":"2010-08-25T02:44:40Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Most references to the DEFAULT_MERGE_LOG_LEN were changed to use that\nsymbolic constant, but a few uses of hardcoded \"20\" remain.\n\nCc: Ramkumar Ramachandra <artagnon@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nNoticed this while looking over ab6beee (merge: Make '--log' an\ninteger option) from pu.  Maybe something like it could be squashed in\nin the next round.\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 425900d..bc7c30f 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -323,10 +323,11 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \tstruct option options[] = {\n \t\t{ OPTION_INTEGER, 0, \"log\", &shortlog_len, \"n\",\n \t\t  \"populate log with <n> entries from shortlog\",\n-\t\t  PARSE_OPT_OPTARG, NULL, 20 },\n+\t\t  PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },\n \t\t{ OPTION_INTEGER, 0, \"summary\", &shortlog_len, \"n\",\n \t\t  \"alias for --log (deprecated)\",\n-\t\t  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },\n+\t\t  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL,\n+\t\t  DEFAULT_MERGE_LOG_LEN },\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\"),\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex bf550a6..9e4733d 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -177,7 +177,7 @@ static struct option builtin_merge_options[] = {\n \tOPT_BOOLEAN(0, \"summary\", &show_diffstat, \"(synonym to --stat)\"),\n \t{ OPTION_INTEGER, 0, \"log\", &shortlog_len, \"n\",\n \t  \"add (at most <n>) entries from shortlog to merge commit message\",\n-\t  PARSE_OPT_OPTARG, NULL, 20 },\n+\t  PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },\n \tOPT_BOOLEAN(0, \"squash\", &squash,\n \t\t\"create a single commit instead of doing a merge\"),\n \tOPT_BOOLEAN(0, \"commit\", &option_commit,\n-- \n"},{"id":"148932","messageId":"20100825035228.GA3280@kytes","threadId":"24829","inReplyTo":"7vmxsbu963.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-25T03:52:31Z","receivedAt":"2010-08-25T03:52:31Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Junio,\n\nJunio C Hamano writes:\n> This makes sense, but I agree with Jonathan's reviews on 1/5 and 2/5, I'll\n> ask you to reroll this on top of what I'll push out shortly.\n\nThanks! I'll rebase on top of rr/fmt-merge-msg in `pu` and re-roll\nlater today.\n\n> As to 4/5, I think we should proceed a lot more carefully than what your\n> patch does, just like we were extra careful when we went to v1.7.0 than\n> when we went to v1.6.0 (see release notes to 1.6.6 for a summary,\n> especially paying attention to the third and the fourth paragraph in\n> \"Preparing yourselves\" section).\n\nOk, I'll look at this and fix the patch accordingly.\n\n> I've queued 5/5 directly on maint.\n\nRight, I saw that.\n\n-- Ram\n"},{"id":"148940","messageId":"20100825045003.GB3280@kytes","threadId":"24829","inReplyTo":"20100823222542.GD1308@burratino","subject":"Re: [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-25T04:50:06Z","receivedAt":"2010-08-25T04:50:06Z","isPatch":true,"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> >  Documentation/git-fmt-merge-msg.txt |   10 +++++-----\n> >  Documentation/merge-options.txt     |    6 +++---\n> >  builtin/fmt-merge-msg.c             |   25 ++++++++++++++-----------\n> >  builtin/merge.c                     |   18 ++++++++++--------\n> >  4 files changed, 32 insertions(+), 27 deletions(-)\n> \n> Is this on top of \"next\"?  I had trouble applying it on top of the\n> update-contrib-example-merge topic.\n[...]\n\nDue to an unfortunate mistake on my part, it's based on `pu`. I'll fix\nall the issues you pointed out and re-roll on top of rr/fmt-merge-msg\nlater today. Thanks.\n\n-- Ram\n"}]}