{"thread":{"id":"24802","subject":"[PATCH 1/4] fmt-merge-msg: Make the number of log entries in commit message configurable","startedAt":"2010-08-20T12:23:57Z","lastAt":"2010-08-20T15:00:21Z","messageCount":10,"participants":["Ramkumar Ramachandra","Johannes Sixt","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"148550","messageId":"1282307041-19681-1-git-send-email-artagnon@gmail.com","threadId":"24802","inReplyTo":null,"subject":"[PATCH 0/4] fmt-merge-msg improvements","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T12:23:57Z","receivedAt":"2010-08-20T12:23:57Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nThe first three parts make `merge.log` and `--log` an integer. While\nat it, drop the deprecated `--summary` option: blame tells me that it\nwas marked deprecated back in 2008. The series is based on pu for no\ngood reason.\n\nThanks to Johannes and Jonathan for their inputs.\n\n-- Ram\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 |   28 +++++++----------------\n Documentation/merge-config.txt      |    8 +++++-\n builtin/fmt-merge-msg.c             |   41 ++++++++++++++++------------------\n 3 files changed, 34 insertions(+), 43 deletions(-)\n"},{"id":"148544","messageId":"1282307041-19681-2-git-send-email-artagnon@gmail.com","threadId":"24802","inReplyTo":"1282307041-19681-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 1/4] fmt-merge-msg: Make the number of log entries in commit message configurable","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T12:23:58Z","receivedAt":"2010-08-20T12:23:58Z","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@onerussian.com>\nCc: Johannes Sixt <j.sixt@viscovery.net>\nCc: Jonathan Nieder <jrnieder@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.1\n"},{"id":"148547","messageId":"1282307041-19681-3-git-send-email-artagnon@gmail.com","threadId":"24802","inReplyTo":"1282307041-19681-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 2/4] fmt-merge-msg: Update command line options to sync with config options","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T12:23:59Z","receivedAt":"2010-08-20T12:23:59Z","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@viscovery.net>\nCc: Jonathan Nieder <jrnieder@gmail.com>\n---\n builtin/fmt-merge-msg.c |   19 +++++++++----------\n 1 files changed, 9 insertions(+), 10 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 66b1cbd..67f24f8 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -11,7 +11,6 @@ static const char * const fmt_merge_msg_usage[] = {\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,8 +326,9 @@ 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\tOPT_INTEGER(0, \"log\", &log_limit,\n+\t\t\t    \"populate log with <n> entries from shortlog\"),\n+\t\t{ OPTION_BOOLEAN, 0, \"summary\", &log_limit, NULL,\n \t\t  \"alias for --log (deprecated)\",\n \t\t  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },\n \t\tOPT_STRING('m', \"message\", &message, \"text\",\n@@ -347,7 +346,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 +365,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.1\n"},{"id":"148545","messageId":"1282307041-19681-4-git-send-email-artagnon@gmail.com","threadId":"24802","inReplyTo":"1282307041-19681-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T12:24:00Z","receivedAt":"2010-08-20T12:24:00Z","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@viscovery.net>\nCc: Jonathan Nieder <jrnieder@gmail.com>\n---\n Documentation/git-fmt-merge-msg.txt |   24 +++++++++---------------\n Documentation/merge-config.txt      |    8 ++++++--\n 2 files changed, 15 insertions(+), 17 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex 302f56b..a930eeb 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>] < $GIT_DIR/FETCH_HEAD\n+'git fmt-merge-msg' [-m <message>] [--log=<n>] -F <file>\n \n DESCRIPTION\n -----------\n@@ -24,19 +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-\n---no-log::\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+\tone-line descriptions from at most <n> actual commits that are\n+\tbeing merged.\n \n -m <message>::\n --message <message>::\n@@ -53,7 +44,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.1\n"},{"id":"148546","messageId":"1282307041-19681-5-git-send-email-artagnon@gmail.com","threadId":"24802","inReplyTo":"1282307041-19681-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 4/4] fmt-merge-msg: Remove deprecated --summary option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T12:24:01Z","receivedAt":"2010-08-20T12:24:01Z","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 |    4 ----\n builtin/fmt-merge-msg.c             |   13 ++-----------\n 2 files changed, 2 insertions(+), 15 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex a930eeb..e3be3a3 100644\n--- a/Documentation/git-fmt-merge-msg.txt\n+++ b/Documentation/git-fmt-merge-msg.txt\n@@ -49,10 +49,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 67f24f8..966647a 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@@ -328,9 +322,6 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \tstruct option options[] = {\n \t\tOPT_INTEGER(0, \"log\", &log_limit,\n \t\t\t    \"populate log with <n> entries from shortlog\"),\n-\t\t{ OPTION_BOOLEAN, 0, \"summary\", &log_limit, NULL,\n-\t\t  \"alias for --log (deprecated)\",\n-\t\t  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },\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.1\n"},{"id":"148551","messageId":"20100820123935.GB9448@kytes","threadId":"24802","inReplyTo":"1282307041-19681-4-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T12:39:50Z","receivedAt":"2010-08-20T12:39:50Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nMinor mistake: This patch removes the --summary option from the\ndocumentation before removing it from the code. Swapping this patch\nwith part 4 will fix the issue.\n\n-- Ram\n"},{"id":"148553","messageId":"4C6E78CB.1090907@viscovery.net","threadId":"24802","inReplyTo":"20100820123935.GB9448@kytes","subject":"Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-08-20T12:44:59Z","receivedAt":"2010-08-20T12:44:59Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 8/20/2010 14:39, schrieb Ramkumar Ramachandra:\n> Minor mistake: This patch removes the --summary option from the\n> documentation before removing it from the code.\n\nNot only that: It also removes --no-log, and makes the argument to --log\nmandatory, doesn't it?\n\n-- Hannes\n"},{"id":"148559","messageId":"20100820131218.GC9448@kytes","threadId":"24802","inReplyTo":"4C6E78CB.1090907@viscovery.net","subject":"Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T13:12:21Z","receivedAt":"2010-08-20T13:12:21Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nJohannes Sixt writes:\n> Am 8/20/2010 14:39, schrieb Ramkumar Ramachandra:\n> > Minor mistake: This patch removes the --summary option from the\n> > documentation before removing it from the code.\n> \n> Not only that: It also removes --no-log, and makes the argument to --log\n> mandatory, doesn't it?\n\nYeah, that was sort of intended- Is this undesired?\n\nI noticed that the command-line parsing framework has only OPT_BOOLEAN\nand OPT_INTEGER, but no OPT_BOOLEAN_OR_INTEGER.\n\n-- Ram\n"},{"id":"148568","messageId":"20100820141035.GD16190@burratino","threadId":"24802","inReplyTo":"20100820131218.GC9448@kytes","subject":"Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-20T14:10:35Z","receivedAt":"2010-08-20T14:10:35Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Ram,\n\nRamkumar Ramachandra wrote:\n\n> I noticed that the command-line parsing framework has only OPT_BOOLEAN\n> and OPT_INTEGER, but no OPT_BOOLEAN_OR_INTEGER.\n\n--no-<foo> works already with OPT_INTEGER.  But for --<foo>, one\nneeds the\n\n { OPTION_INTEGER, short, long, &var, \"n\", description,\n   PARSE_OPT_OPTARG, NULL, 20 },\n\nform.\n"},{"id":"148575","messageId":"20100820150019.GF9448@kytes","threadId":"24802","inReplyTo":"20100820141035.GD16190@burratino","subject":"Re: [PATCH 3/4] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-20T15:00:21Z","receivedAt":"2010-08-20T15:00:21Z","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> > I noticed that the command-line parsing framework has only OPT_BOOLEAN\n> > and OPT_INTEGER, but no OPT_BOOLEAN_OR_INTEGER.\n> \n> --no-<foo> works already with OPT_INTEGER.  But for --<foo>, one\n> needs the\n> \n>  { OPTION_INTEGER, short, long, &var, \"n\", description,\n>    PARSE_OPT_OPTARG, NULL, 20 },\n> \n> form.\n\nThanks, I'll re-roll with this fix.\n\n-- Ram\n"}]}