{"thread":{"id":"25040","subject":"[PATCH 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len","startedAt":"2010-09-08T17:59:52Z","lastAt":"2010-09-08T17:59:57Z","messageCount":6,"participants":["Ramkumar Ramachandra"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"150313","messageId":"1283968797-31793-1-git-send-email-artagnon@gmail.com","threadId":"25040","inReplyTo":null,"subject":"[PATCH 0/5] Re-roll rr/fmt-merge-msg","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-08T17:59:52Z","receivedAt":"2010-09-08T17:59:52Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Changes since last time: Negative shortlog length is now treated as an\nerror. I've done it keeping in mind Jonathan's INF series.\n\nRamkumar Ramachandra (5):\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  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 Documentation/git-fmt-merge-msg.txt |   16 ++++--\n Documentation/merge-config.txt      |    6 ++-\n Documentation/merge-options.txt     |    6 +-\n builtin.h                           |    7 ++-\n builtin/fmt-merge-msg.c             |   60 ++++++++++++-----------\n builtin/merge.c                     |   32 +++++++-----\n t/t6200-fmt-merge-msg.sh            |   91 +++++++++++++++++++++++++++++++++++\n 7 files changed, 163 insertions(+), 55 deletions(-)\n\n-- \n1.7.2.2.409.gdbb11.dirty\n"},{"id":"150312","messageId":"1283968797-31793-2-git-send-email-artagnon@gmail.com","threadId":"25040","inReplyTo":"1283968797-31793-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-08T17:59:53Z","receivedAt":"2010-09-08T17:59:53Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Give \"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>\nMentored-by: Jonathan Nieder <jrnieder@gmail.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.409.gdbb11.dirty\n"},{"id":"150314","messageId":"1283968797-31793-3-git-send-email-artagnon@gmail.com","threadId":"25040","inReplyTo":"1283968797-31793-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 2/5] merge: Make '--log' an integer option for number of shortlog entries","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-08T17:59:54Z","receivedAt":"2010-09-08T17:59:54Z","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             |   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..455e7c6 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 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-\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\tdie(\"Negative --log=%d\", shortlog_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":"150317","messageId":"1283968797-31793-4-git-send-email-artagnon@gmail.com","threadId":"25040","inReplyTo":"1283968797-31793-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 3/5] merge: Make 'merge.log' an integer or boolean option","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-08T17:59:55Z","receivedAt":"2010-09-08T17:59:55Z","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 |    6 ++++--\n Documentation/merge-config.txt      |    6 ++++--\n builtin/fmt-merge-msg.c             |   16 +++++++---------\n builtin/merge.c                     |    7 ++++++-\n 4 files changed, 21 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 455e7c6..5deba65 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -15,15 +15,13 @@ 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 < 0)\n+\t\t\treturn error(\"%s: negative length %s\", key, value);\n+\t\tif (is_bool && shortlog_len)\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..1e9c898 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -503,7 +503,12 @@ 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 < 0)\n+\t\t\treturn error(\"%s: negative length %s\", k, v);\n+\t\tif (is_bool && shortlog_len)\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":"150315","messageId":"1283968797-31793-5-git-send-email-artagnon@gmail.com","threadId":"25040","inReplyTo":"1283968797-31793-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 4/5] t6200-fmt-merge-msg: Exercise 'merge.log' to configure shortlog length","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-08T17:59:56Z","receivedAt":"2010-09-08T17:59:56Z","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 |   48 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 48 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh\nindex 71f6cad..9b600a8 100755\n--- a/t/t6200-fmt-merge-msg.sh\n+++ b/t/t6200-fmt-merge-msg.sh\n@@ -129,6 +129,54 @@ 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 '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":"150316","messageId":"1283968797-31793-6-git-send-email-artagnon@gmail.com","threadId":"25040","inReplyTo":"1283968797-31793-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 5/5] t6200-fmt-merge-msg: Exercise '--log' to configure shortlog length","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-08T17:59:57Z","receivedAt":"2010-09-08T17:59:57Z","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 |   43 +++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 43 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh\nindex 9b600a8..9a16806 100755\n--- a/t/t6200-fmt-merge-msg.sh\n+++ b/t/t6200-fmt-merge-msg.sh\n@@ -177,6 +177,49 @@ test_expect_success 'merge.log=0 disables shortlog' '\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 'fmt-merge-msg -m' '\n \techo \"Sync with left\" >expected &&\n \tcat >expected.log <<-EOF &&\n-- \n1.7.2.2.409.gdbb11.dirty\n"}]}