{"thread":{"id":"24892","subject":"[PATCH 0/3] rr/fmt-merge-msg replacements","startedAt":"2010-08-28T10:35:31Z","lastAt":"2010-09-01T04:22:50Z","messageCount":12,"participants":["Ramkumar Ramachandra","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"149158","messageId":"1282991734-3368-1-git-send-email-artagnon@gmail.com","threadId":"24892","inReplyTo":null,"subject":"[PATCH 0/3] rr/fmt-merge-msg replacements","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-28T10:35:31Z","receivedAt":"2010-08-28T10:35:31Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"I found a problem while writing the test for -1: the first patch is a\ncorrection for that; sorry I didn't detect it earlier.\n\nThe second and third patches are rewrites of the tests I submitted\nearlier- the rest of the file needs to be cleaned up to match this\nstyle. Thanks Jonathan.\n\nRamkumar Ramachandra (3):\n  fmt-merge-msg: Disallow '--log', 'merge.log' < 0\n  t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog\n    length\n  t6200-fmt-merge-msg: Exercise '--log' to configure shortlog length\n\n builtin/fmt-merge-msg.c |    4 +++-\n builtin/merge.c         |    2 +-\n t/t6200-fmt-merge-msg.sh |  123 ++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 127 insertions(+), 2 deletions(-)\n\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"149162","messageId":"1282991734-3368-2-git-send-email-artagnon@gmail.com","threadId":"24892","inReplyTo":"1282991734-3368-1-git-send-email-artagnon@gmail.com","subject":"[PATCH] fmt-merge-msg: Disallow '--log', 'merge.log' < 0","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-28T10:35:32Z","receivedAt":"2010-08-28T10:35:32Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Explicitly check for the case when '--log' or 'merge.log' is passed a\nnegative integer argument. Handle the case by making it look as if\nsuch an argument was never parsed.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n builtin/fmt-merge-msg.c |    4 +++-\n builtin/merge.c         |    2 +-\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex d3b8297..0684179 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -18,7 +18,7 @@ static int fmt_merge_msg_config(const char *key, const char *value, void *cb)\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\tif ((is_bool && shortlog_len) || shortlog_len < 0)\n \t\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n \t}\n \treturn 0;\n@@ -345,6 +345,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\twrite_in_full(STDOUT_FILENO, &nl, 1);\n \t\treturn 0;\n \t}\n+\tif (shortlog_len < 0)\n+\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n \n \tif (inpath && strcmp(inpath, \"-\")) {\n \t\tin = fopen(inpath, \"r\");\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 55dc571..affa197 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -510,7 +510,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)\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\tif ((is_bool && shortlog_len) || shortlog_len < 0)\n \t\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n \t\treturn 0;\n \t} else if (!strcmp(k, \"merge.renormalize\"))\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"149159","messageId":"1282991734-3368-3-git-send-email-artagnon@gmail.com","threadId":"24892","inReplyTo":"1282991734-3368-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 2/3] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-28T10:35:33Z","receivedAt":"2010-08-28T10:35:33Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Add a test to exercise the 'merge.log' configuration option of 'git\nfmt-merge-msg'. It controls the number of shortlog entries to display\nin merge commit messages.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nThanks-to: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t6200-fmt-merge-msg.sh |   64 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 64 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh\nindex 71f6cad..528fdf9 100755\n--- a/t/t6200-fmt-merge-msg.sh\n+++ b/t/t6200-fmt-merge-msg.sh\n@@ -129,6 +129,70 @@ test_expect_success '[merge] summary/log configuration' '\n \ttest_cmp expected actual2\n '\n \n+test_expect_success 'setup: clear [merge] configuration' '\n+\ttest_might_fail git config --unset-all merge.log &&\n+\ttest_might_fail git config --unset-all merge.summary\n+'\n+\n+test_expect_success 'setup FETCH_HEAD' '\n+\tgit checkout master &&\n+\ttest_tick &&\n+\tgit fetch . left\n+'\n+\n+test_expect_success 'merge.log=3 limits shortlog length' '\n+\tcat >expected <<-EOF &&\n+\tMerge branch ${apos}left${apos}\n+\n+\t* left: (5 commits)\n+\t  Left #5\n+\t  Left #4\n+\t  Left #3\n+\t  ...\n+\tEOF\n+\n+\tgit -c merge.log=3 fmt-merge-msg <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'merge.log=5 shows all 5 commits' '\n+\tcat >expected <<-EOF &&\n+\tMerge branch ${apos}left${apos}\n+\n+\t* left:\n+\t  Left #5\n+\t  Left #4\n+\t  Left #3\n+\t  Common #2\n+\t  Common #1\n+\tEOF\n+\n+\tgit -c merge.log=5 fmt-merge-msg <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'merge.log=0 disables shortlog' '\n+\techo \"Merge branch ${apos}left${apos}\" >expected\n+\tgit -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success 'merge.log=-1 does something sane' '\n+\tcat >expected <<-EOF &&\n+\tMerge branch ${apos}left${apos}\n+\n+\t* left:\n+\t  Left #5\n+\t  Left #4\n+\t  Left #3\n+\t  Common #2\n+\t  Common #1\n+\tEOF\n+\n+\tgit -c merge.log=-1 fmt-merge-msg <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'fmt-merge-msg -m' '\n \techo \"Sync with left\" >expected &&\n \tcat >expected.log <<-EOF &&\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"149160","messageId":"1282991734-3368-4-git-send-email-artagnon@gmail.com","threadId":"24892","inReplyTo":"1282991734-3368-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 3/3] t6200-fmt-merge-msg: Exercise '--log' to configure shortlog length","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-28T10:35:34Z","receivedAt":"2010-08-28T10:35:34Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Add a test to exercise the '--log' command-line option of 'git\nfmt-merge-msg'. It controls the number of shortlog entries to display\nin merge commit messages.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\nThanks-to: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t6200-fmt-merge-msg.sh |   59 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 59 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh\nindex 528fdf9..395c23e 100755\n--- a/t/t6200-fmt-merge-msg.sh\n+++ b/t/t6200-fmt-merge-msg.sh\n@@ -193,6 +193,65 @@ test_expect_success 'merge.log=-1 does something sane' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success '--log=3 limits shortlog length' '\n+\tcat >expected <<-EOF &&\n+\tMerge branch ${apos}left${apos}\n+\n+\t* left: (5 commits)\n+\t  Left #5\n+\t  Left #4\n+\t  Left #3\n+\t  ...\n+\tEOF\n+\n+\tgit fmt-merge-msg --log=3 <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success '--log=5 shows all 5 commits' '\n+\tcat >expected <<-EOF &&\n+\tMerge branch ${apos}left${apos}\n+\n+\t* left:\n+\t  Left #5\n+\t  Left #4\n+\t  Left #3\n+\t  Common #2\n+\t  Common #1\n+\tEOF\n+\n+\tgit fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success '--no-log disables shortlog' '\n+\techo \"Merge branch ${apos}left${apos}\" >expected &&\n+\tgit fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success '--log=0 disables shortlog' '\n+\techo \"Merge branch ${apos}left${apos}\" >expected &&\n+\tgit fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n+test_expect_success '--log=-1 does something sane' '\n+\tcat >expected <<-EOF &&\n+\tMerge branch ${apos}left${apos}\n+\n+\t* left:\n+\t  Left #5\n+\t  Left #4\n+\t  Left #3\n+\t  Common #2\n+\t  Common #1\n+\tEOF\n+\n+\tgit fmt-merge-msg --log=-1 <.git/FETCH_HEAD >actual &&\n+\ttest_cmp expected actual\n+'\n+\n test_expect_success 'fmt-merge-msg -m' '\n \techo \"Sync with left\" >expected &&\n \tcat >expected.log <<-EOF &&\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"149394","messageId":"1283226800-28980-1-git-send-email-artagnon@gmail.com","threadId":"24892","inReplyTo":"1282991734-3368-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-31T03:53:19Z","receivedAt":"2010-08-31T03:53:19Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Replacement for b5cdf2a.\n\n Documentation/git-fmt-merge-msg.txt |   10 ++++++----\n Documentation/merge-options.txt     |    6 +++---\n builtin/fmt-merge-msg.c             |   28 ++++++++++++++++++----------\n builtin/merge.c                     |   17 ++++++++++-------\n 4 files changed, 37 insertions(+), 24 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex 302f56b..f04a9ff 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,12 @@ 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+\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 --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..e33e0f8 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 at most <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 42021d3..0997c26 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -7,21 +7,24 @@\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) ? DEFAULT_MERGE_LOG_LEN : 0;\n+\t\treturn 0;\n+\t}\n+\tif (!found_merge_log && !strcmp(\"merge.summary\", key)) {\n+\t\tshortlog_len = git_config_bool(key, value) ? DEFAULT_MERGE_LOG_LEN : 0;\n+\t\treturn 0;\n \t}\n-\tif (!found_merge_log && !strcmp(\"merge.summary\", key))\n-\t\tmerge_summary = git_config_bool(key, value);\n \treturn 0;\n }\n \n@@ -318,10 +321,13 @@ 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\", &shortlog_len, \"n\",\n+\t\t  \"populate log with <n> entries from shortlog\",\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_NOARG | PARSE_OPT_HIDDEN },\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\"),\n@@ -337,12 +343,14 @@ 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 \t\treturn 0;\n \t}\n+\tif (shortlog_len < 0)\n+\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n \n \tif (inpath && strcmp(inpath, \"-\")) {\n \t\tin = fopen(inpath, \"r\");\n@@ -357,7 +365,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\tstrbuf_addstr(&output, message);\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+\t\t\t    shortlog_len);\n \n \tif (ret)\n \t\treturn ret;\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex b2c0984..9e4733d 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@@ -175,8 +175,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  \"add (at most <n>) entries from shortlog to merge commit message\",\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@@ -501,8 +502,10 @@ 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\toption_log = git_config_bool(k, v);\n+\telse if (!strcmp(k, \"merge.log\") || !strcmp(k, \"merge.summary\")) {\n+\t\tshortlog_len = git_config_bool(k, v) ? DEFAULT_MERGE_LOG_LEN : 0;\n+\t\treturn 0;\n+\t}\n \treturn git_diff_ui_config(k, v, cb);\n }\n \n@@ -998,9 +1001,9 @@ 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\tif (!have_message || shortlog_len) {\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\t\t      shortlog_len);\n \t\t\tif (merge_msg.len)\n \t\t\t\tstrbuf_setlen(&merge_msg, merge_msg.len - 1);\n \t\t}\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"149395","messageId":"1283226800-28980-2-git-send-email-artagnon@gmail.com","threadId":"24892","inReplyTo":"1282991734-3368-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 2/2] merge: Make 'merge.log' an integer or boolean option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-31T03:53:20Z","receivedAt":"2010-08-31T03:53:20Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Replacement for afdcbdc.\n\n Documentation/git-fmt-merge-msg.txt |    6 ++++--\n Documentation/merge-config.txt      |    6 ++++--\n builtin/fmt-merge-msg.c             |   14 +++++---------\n builtin/merge.c                     |    5 ++++-\n 4 files changed, 17 insertions(+), 14 deletions(-)\n\ndiff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt\nindex f04a9ff..40dba8c 100644\n--- a/Documentation/git-fmt-merge-msg.txt\n+++ b/Documentation/git-fmt-merge-msg.txt\n@@ -54,8 +54,10 @@ CONFIGURATION\n -------------\n \n merge.log::\n-\tWhether to include summaries of merged commits in newly\n-\tmerge commit messages. False by default.\n+\tIn addition to branch names, populate the log message with at\n+\tmost the specified number of one-line descriptions from the\n+\tactual commits that are being merged.  Defaults to false, and\n+\ttrue is a synoym for 20.\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 a403155..acbe1e1 100644\n--- a/Documentation/merge-config.txt\n+++ b/Documentation/merge-config.txt\n@@ -7,8 +7,10 @@ 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+\tIn addition to branch names, populate the log message with at\n+\tmost the specified number of one-line descriptions from the\n+\tactual commits that are being merged.  Defaults to false, and\n+\ttrue is a synoym for 20.\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 0997c26..975ef6a 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -15,15 +15,11 @@ 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) ? DEFAULT_MERGE_LOG_LEN : 0;\n-\t\treturn 0;\n-\t}\n-\tif (!found_merge_log && !strcmp(\"merge.summary\", key)) {\n-\t\tshortlog_len = git_config_bool(key, value) ? DEFAULT_MERGE_LOG_LEN : 0;\n-\t\treturn 0;\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 || shortlog_len < 0)\n+\t\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n \t}\n \treturn 0;\n }\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 9e4733d..57ea8d7 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -503,7 +503,10 @@ 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\tshortlog_len = git_config_bool(k, v) ? DEFAULT_MERGE_LOG_LEN : 0;\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 || shortlog_len < 0)\n+\t\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n \t\treturn 0;\n \t}\n \treturn git_diff_ui_config(k, v, cb);\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"149416","messageId":"20100831143236.GC2315@burratino","threadId":"24892","inReplyTo":"1283226800-28980-1-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-31T14:32:36Z","receivedAt":"2010-08-31T14:32:36Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ramkumar Ramachandra wrote:\n\n> Change the command-line '--log' option from a boolean option to an\n> integer option\n\nWhat does \"git merge --log=-1\" do?\n\nIt looks like you have made \"git fmt-merge-msg --log=-1\" equivalent to\n--log=20, but it might be better to error out or use INT_MAX or\nsomething (especially because of plans to make -1 mean \"infinity\"\nlater).\n\nThanks for your perseverance.  Aside from those two nits, the patch\nlooks good.\n"},{"id":"149470","messageId":"7vzkw2abpz.fsf@alter.siamese.dyndns.org","threadId":"24892","inReplyTo":"20100831143236.GC2315@burratino","subject":"Re: [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-31T18:17:12Z","receivedAt":"2010-08-31T18:17:12Z","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> Ramkumar Ramachandra wrote:\n>\n>> Change the command-line '--log' option from a boolean option to an\n>> integer option\n>\n> What does \"git merge --log=-1\" do?\n>\n> It looks like you have made \"git fmt-merge-msg --log=-1\" equivalent to\n> --log=20, but it might be better to error out or use INT_MAX or\n> something (especially because of plans to make -1 mean \"infinity\"\n> later).\n\nHmm, do we plan on that?  It sounds a little bit insane.  Erroring it out\nwould be Ok.  How about doing this on top?\n\n builtin/fmt-merge-msg.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 0997c26..7c6e226 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -322,7 +322,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \tconst char *message = NULL;\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  \"populate log with at most <n> entries from shortlog\",\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@@ -350,7 +350,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n \t\treturn 0;\n \t}\n \tif (shortlog_len < 0)\n-\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n+\t\tdie(\"Negative --log=%d???\", shortlog_len);\n \n \tif (inpath && strcmp(inpath, \"-\")) {\n \t\tin = fopen(inpath, \"r\");\n"},{"id":"149471","messageId":"20100831182120.GR2315@burratino","threadId":"24892","inReplyTo":"7vzkw2abpz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-31T18:21:20Z","receivedAt":"2010-08-31T18:21:20Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> Hmm, do we plan on that?  It sounds a little bit insane.\n\nI sent an RFC patch with -1 as internal representation for \"git grep\n-Cinfinity\".  Infinity was the length Yaroslav was most interested in\nfor merge.log (not sure why, really).\n\nRegardless, it's true that that would probably not be a detail to\nexpose.\n\n> How about doing this on top?\n[...]\n> --- a/builtin/fmt-merge-msg.c\n> +++ b/builtin/fmt-merge-msg.c\n> @@ -322,7 +322,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n>  \tconst char *message = NULL;\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  \"populate log with at most <n> entries from shortlog\",\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> @@ -350,7 +350,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n>  \t\treturn 0;\n>  \t}\n>  \tif (shortlog_len < 0)\n> -\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n> +\t\tdie(\"Negative --log=%d???\", shortlog_len);\n\nLooks good to me (modulo punctuation :)).\n"},{"id":"149482","messageId":"20100831191324.GA27381@kytes","threadId":"24892","inReplyTo":"7vzkw2abpz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-31T19:13:37Z","receivedAt":"2010-08-31T19:13:37Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nJunio C Hamano writes:\n> Hmm, do we plan on that?  It sounds a little bit insane.  Erroring it out\n> would be Ok.  How about doing this on top?\n\n> @@ -350,7 +350,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)\n>  \t\treturn 0;\n>  \t}\n>  \tif (shortlog_len < 0)\n> -\t\tshortlog_len = DEFAULT_MERGE_LOG_LEN;\n> +\t\tdie(\"Negative --log=%d???\", shortlog_len);\n>  \n>  \tif (inpath && strcmp(inpath, \"-\")) {\n>  \t\tin = fopen(inpath, \"r\");\n\nIt's a little asymmetric- the program won't error out when 'merge.log'\nis set to -1. Then again, it's probably nicer to simply pretend that\nwe didn't see that invalid configuration.\n\nAlso, to avoid breaking the '--log=-1' test, either drop the test\naltogether or use something like this:\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n\ndiff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh\nindex 395c23e..3bfdebc 100755\n--- a/t/t6200-fmt-merge-msg.sh\n+++ b/t/t6200-fmt-merge-msg.sh\n@@ -236,7 +236,7 @@ test_expect_success '--log=0 disables shortlog' '\n \ttest_cmp expected actual\n '\n \n-test_expect_success '--log=-1 does something sane' '\n+test_expect_code 128 '--log=-1 errors out' '\n \tcat >expected <<-EOF &&\n \tMerge branch ${apos}left${apos}\n \n@@ -248,8 +248,7 @@ test_expect_success '--log=-1 does something sane' '\n \t  Common #1\n \tEOF\n \n-\tgit fmt-merge-msg --log=-1 <.git/FETCH_HEAD >actual &&\n-\ttest_cmp expected actual\n+\tgit fmt-merge-msg --log=-1 <.git/FETCH_HEAD >actual\n '\n \n test_expect_success 'fmt-merge-msg -m' '\n"},{"id":"149494","messageId":"7vfwxua79a.fsf@alter.siamese.dyndns.org","threadId":"24892","inReplyTo":"20100831191324.GA27381@kytes","subject":"Re: [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-31T19:53:37Z","receivedAt":"2010-08-31T19:53:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> It's a little asymmetric- the program won't error out when 'merge.log'\n> is set to -1.\n\nAnd what is the reason you do not want to diagnose that as an error?\n"},{"id":"149529","messageId":"20100901042247.GB26496@kytes","threadId":"24892","inReplyTo":"7vfwxua79a.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-01T04:22:50Z","receivedAt":"2010-09-01T04:22:50Z","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> Ramkumar Ramachandra <artagnon@gmail.com> writes:\n> \n> > It's a little asymmetric- the program won't error out when 'merge.log'\n> > is set to -1.\n> \n> And what is the reason you do not want to diagnose that as an error?\n\nOh, I'm just saying I'm not sure what the behavior should be. Okay- if\nerroring out is the desired result, I'll fixup and re-roll in a bit.\n\n-- Ram\n"}]}