git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH v5 0/5] merge --log configurability
@ 2010-08-22 16:26 Ramkumar Ramachandra
  2010-08-22 16:26 ` [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len Ramkumar Ramachandra
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-22 16:26 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
	Junio C Hamano

This series is a complete rewrite after Jonathan's last review. I've
tried to pay close attention to detail and be as careful as possible-
let me know if I've missed something.

Thanks.

Jonathan Nieder (1):
  parse-options: clarify PARSE_OPT_NOARG description

Ramkumar Ramachandra (4):
  fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len
  merge: Make '--log' an integer option for number of shortlog entries
  merge: Make 'merge.log' an integer or boolean option
  fmt-merge-msg: Remove deprecated '--summary' option

 Documentation/git-fmt-merge-msg.txt |   23 +++++----------
 Documentation/merge-config.txt      |    8 ++++-
 Documentation/merge-options.txt     |   11 ++-----
 builtin.h                           |    5 +--
 builtin/fmt-merge-msg.c             |   49 ++++++++++++++++------------------
 builtin/merge.c                     |   25 +++++++++++------
 parse-options.h                     |    2 +-
 7 files changed, 59 insertions(+), 64 deletions(-)

-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len
  2010-08-22 16:26 [PATCH v5 0/5] merge --log configurability Ramkumar Ramachandra
@ 2010-08-22 16:26 ` Ramkumar Ramachandra
  2010-08-23 22:00   ` Jonathan Nieder
  2010-08-22 16:26 ` [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries Ramkumar Ramachandra
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-22 16:26 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
	Junio C Hamano

Update the API of the fmt_merge_msg function to replace the the
merge_summary argument with a new shortlog_len argument. Update the
callers track this change: when translating from merge_summary to
shortlog_len, note that 0 means no shortlog and 20 is the default
"enabled" value.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
---
 builtin.h               |    5 ++---
 builtin/fmt-merge-msg.c |   24 +++++++++++-------------
 builtin/merge.c         |    5 +++--
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/builtin.h b/builtin.h
index 9c3d50b..1993166 100644
--- a/builtin.h
+++ b/builtin.h
@@ -14,9 +14,8 @@ extern const char git_more_info_string[];
 extern void list_common_cmds_help(void);
 extern const char *help_unknown_cmd(const char *cmd);
 extern void prune_packed_objects(int);
-extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
-	struct strbuf *out);
-extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);
+extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
+			 int merge_title, int shortlog_len);
 extern int commit_notes(struct notes_tree *t, const char *msg);
 
 struct notes_rewrite_cfg {
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index e7e12ee..4ed728a 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -255,9 +255,9 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
 		strbuf_addf(out, " into %s\n", current_branch);
 }
 
-static int do_fmt_merge_msg(int merge_title, int merge_summary,
-	struct strbuf *in, struct strbuf *out) {
-	int limit = 20, i = 0, pos = 0;
+static int do_fmt_merge_msg(int merge_title, struct strbuf *in,
+	struct strbuf *out, int shortlog_len) {
+	int i = 0, pos = 0;
 	unsigned char head_sha1[20];
 	const char *current_branch;
 
@@ -288,7 +288,7 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,
 	if (merge_title)
 		do_fmt_merge_msg_title(out, current_branch);
 
-	if (merge_summary) {
+	if (shortlog_len) {
 		struct commit *head;
 		struct rev_info rev;
 
@@ -303,17 +303,14 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,
 
 		for (i = 0; i < origins.nr; i++)
 			shortlog(origins.items[i].string, origins.items[i].util,
-					head, &rev, limit, out);
+					head, &rev, shortlog_len, out);
 	}
 	return 0;
 }
 
-int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
-	return do_fmt_merge_msg(1, merge_summary, in, out);
-}
-
-int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {
-	return do_fmt_merge_msg(0, 1, in, out);
+int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
+		  int merge_title, int shortlog_len) {
+	return do_fmt_merge_msg(merge_title, in, out, shortlog_len);
 }
 
 int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
@@ -357,9 +354,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 		die_errno("could not read input file");
 	if (message) {
 		strbuf_addstr(&output, message);
-		ret = fmt_merge_msg_shortlog(&input, &output);
+		ret = fmt_merge_msg(&input, &output, 0, 20);
 	} else {
-		ret = fmt_merge_msg(merge_summary, &input, &output);
+		ret = fmt_merge_msg(&input, &output, 1,
+				    merge_summary ? 20 : 0);
 	}
 	if (ret)
 		return ret;
diff --git a/builtin/merge.c b/builtin/merge.c
index 4e4ec89..d47f48f 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1014,9 +1014,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 			merge_name(argv[i], &merge_names);
 
 		if (have_message && option_log)
-			fmt_merge_msg_shortlog(&merge_names, &merge_msg);
+			fmt_merge_msg(&merge_names, &merge_msg, 0, 20);
 		else if (!have_message)
-			fmt_merge_msg(option_log, &merge_names, &merge_msg);
+			fmt_merge_msg(&merge_names, &merge_msg, 1,
+				      option_log ? 20: 0);
 
 
 		if (!(have_message && !option_log) && merge_msg.len)
-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries
  2010-08-22 16:26 [PATCH v5 0/5] merge --log configurability Ramkumar Ramachandra
  2010-08-22 16:26 ` [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len Ramkumar Ramachandra
@ 2010-08-22 16:26 ` Ramkumar Ramachandra
  2010-08-23 22:25   ` Jonathan Nieder
  2010-08-22 16:26 ` [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option Ramkumar Ramachandra
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-22 16:26 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
	Junio C Hamano

Change the command-line '--log' option from a boolean option to an
integer option, and parse the optional integer provided on the
command-line into the 'shortlog_len' variable. Also update the
documentation accordingly.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reported-by: Yaroslav Halchenko <debian@onerussian.com>
Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Johannes Sixt <j.sixt@viscovery.net>
---
 Documentation/git-fmt-merge-msg.txt |   10 +++++-----
 Documentation/merge-options.txt     |    6 +++---
 builtin/fmt-merge-msg.c             |   25 ++++++++++++++-----------
 builtin/merge.c                     |   18 ++++++++++--------
 4 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt
index 302f56b..14ac466 100644
--- a/Documentation/git-fmt-merge-msg.txt
+++ b/Documentation/git-fmt-merge-msg.txt
@@ -9,8 +9,8 @@ git-fmt-merge-msg - Produce a merge commit message
 SYNOPSIS
 --------
 [verse]
-'git fmt-merge-msg' [-m <message>] [--log | --no-log] <$GIT_DIR/FETCH_HEAD
-'git fmt-merge-msg' [-m <message>] [--log | --no-log] -F <file>
+'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log] <$GIT_DIR/FETCH_HEAD
+'git fmt-merge-msg' [-m <message>] [--log[=<n>] | --no-log] -F <file>
 
 DESCRIPTION
 -----------
@@ -24,10 +24,10 @@ automatically invoking 'git merge'.
 OPTIONS
 -------
 
---log::
+--log[=<n>]::
 	In addition to branch names, populate the log message with
-	one-line descriptions from the actual commits that are being
-	merged.
+	one-line descriptions from at most <n> actual commits that are
+	being merged. If omitted, <n> defaults to 20.
 
 --no-log::
 	Do not list one-line descriptions from the actual commits being
diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
index 722d704..1083f19 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -16,11 +16,11 @@ inspect and further tweak the merge result before committing.
 With --no-ff Generate a merge commit even if the merge
 resolved as a fast-forward.
 
---log::
+--log[=<n>]::
 --no-log::
 	In addition to branch names, populate the log message with
-	one-line descriptions from the actual commits that are being
-	merged.
+	one-line descriptions from <n> actual commits that are being
+	merged. See also linkgit:git-fmt-merge-msg[1].
 +
 With --no-log do not list one-line descriptions from the
 actual commits being merged.
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 4ed728a..1c5da95 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -7,21 +7,21 @@
 #include "string-list.h"
 
 static const char * const fmt_merge_msg_usage[] = {
-	"git fmt-merge-msg [-m <message>] [--log|--no-log] [--file <file>]",
+	"git fmt-merge-msg [-m <message>] [--log[=<n>]|--no-log] [--file <file>]",
 	NULL
 };
 
-static int merge_summary;
+static int shortlog_len;
 
 static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
 {
 	static int found_merge_log = 0;
 	if (!strcmp("merge.log", key)) {
 		found_merge_log = 1;
-		merge_summary = git_config_bool(key, value);
+		shortlog_len = git_config_bool(key, value);
 	}
 	if (!found_merge_log && !strcmp("merge.summary", key))
-		merge_summary = git_config_bool(key, value);
+		shortlog_len = git_config_bool(key, value);
 	return 0;
 }
 
@@ -318,10 +318,12 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 	const char *inpath = NULL;
 	const char *message = NULL;
 	struct option options[] = {
-		OPT_BOOLEAN(0, "log",     &merge_summary, "populate log with the shortlog"),
-		{ OPTION_BOOLEAN, 0, "summary", &merge_summary, NULL,
-		  "alias for --log (deprecated)",
-		  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
+		{ OPTION_INTEGER, 0, "log", &shortlog_len, "n",
+		  "populate log with <n> entries from shortlog",
+		  PARSE_OPT_OPTARG, NULL, 20 },
+		{ OPTION_INTEGER, 0, "summary", &shortlog_len, "n",
+                  "alias for --log (deprecated)",
+		  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },
 		OPT_STRING('m', "message", &message, "text",
 			"use <text> as start of message"),
 		OPT_FILENAME('F', "file", &inpath, "file to read from"),
@@ -337,7 +339,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 			     0);
 	if (argc > 0)
 		usage_with_options(fmt_merge_msg_usage, options);
-	if (message && !merge_summary) {
+	if (message && !shortlog_len) {
 		char nl = '\n';
 		write_in_full(STDOUT_FILENO, message, strlen(message));
 		write_in_full(STDOUT_FILENO, &nl, 1);
@@ -354,10 +356,11 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 		die_errno("could not read input file");
 	if (message) {
 		strbuf_addstr(&output, message);
-		ret = fmt_merge_msg(&input, &output, 0, 20);
+		ret = fmt_merge_msg(&input, &output, 0,
+				    shortlog_len);
 	} else {
 		ret = fmt_merge_msg(&input, &output, 1,
-				    merge_summary ? 20 : 0);
+				    shortlog_len);
 	}
 	if (ret)
 		return ret;
diff --git a/builtin/merge.c b/builtin/merge.c
index d47f48f..994b0c5 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -42,7 +42,7 @@ static const char * const builtin_merge_usage[] = {
 	NULL
 };
 
-static int show_diffstat = 1, option_log, squash;
+static int show_diffstat = 1, shortlog_len, squash;
 static int option_commit = 1, allow_fast_forward = 1;
 static int fast_forward_only;
 static int allow_trivial = 1, have_message;
@@ -177,8 +177,9 @@ static struct option builtin_merge_options[] = {
 	OPT_BOOLEAN(0, "stat", &show_diffstat,
 		"show a diffstat at the end of the merge"),
 	OPT_BOOLEAN(0, "summary", &show_diffstat, "(synonym to --stat)"),
-	OPT_BOOLEAN(0, "log", &option_log,
-		"add list of one-line log to merge commit message"),
+	{ OPTION_INTEGER, 0, "log", &shortlog_len, "n",
+	  "populate log with <n> entries from shortlog",
+	  PARSE_OPT_OPTARG, NULL, 20 },
 	OPT_BOOLEAN(0, "squash", &squash,
 		"create a single commit instead of doing a merge"),
 	OPT_BOOLEAN(0, "commit", &option_commit,
@@ -505,7 +506,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)
 	else if (!strcmp(k, "pull.octopus"))
 		return git_config_string(&pull_octopus, k, v);
 	else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary"))
-		option_log = git_config_bool(k, v);
+		shortlog_len = git_config_bool(k, v);
 	else if (!strcmp(k, "merge.renormalize"))
 		option_renormalize = git_config_bool(k, v);
 	return git_diff_ui_config(k, v, cb);
@@ -1013,14 +1014,15 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		for (i = 0; i < argc; i++)
 			merge_name(argv[i], &merge_names);
 
-		if (have_message && option_log)
-			fmt_merge_msg(&merge_names, &merge_msg, 0, 20);
+		if (have_message && shortlog_len)
+			fmt_merge_msg(&merge_names, &merge_msg, 0,
+				      shortlog_len);
 		else if (!have_message)
 			fmt_merge_msg(&merge_names, &merge_msg, 1,
-				      option_log ? 20: 0);
+				      shortlog_len);
 
 
-		if (!(have_message && !option_log) && merge_msg.len)
+		if (!(have_message && !shortlog_len) && merge_msg.len)
 			strbuf_setlen(&merge_msg, merge_msg.len-1);
 	}
 
-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option
  2010-08-22 16:26 [PATCH v5 0/5] merge --log configurability Ramkumar Ramachandra
  2010-08-22 16:26 ` [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len Ramkumar Ramachandra
  2010-08-22 16:26 ` [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries Ramkumar Ramachandra
@ 2010-08-22 16:26 ` Ramkumar Ramachandra
  2010-08-24 19:01   ` Junio C Hamano
  2010-08-22 16:26 ` [PATCH v5 4/5] fmt-merge-msg: Remove deprecated '--summary' option Ramkumar Ramachandra
  2010-08-22 16:26 ` [PATCH v5 5/5] parse-options: clarify PARSE_OPT_NOARG description Ramkumar Ramachandra
  4 siblings, 1 reply; 13+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-22 16:26 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
	Junio C Hamano

Make 'merge.log' an integer or boolean option to set the number of
shortlog entries to display in the merge commit. Note that it defaults
to false, and that true means a default value of 20. Also update
corresponding documentation.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Johannes Sixt <j.sixt@viscovery.net>
---
 Documentation/git-fmt-merge-msg.txt |    8 +++++---
 Documentation/merge-config.txt      |    8 ++++++--
 builtin/fmt-merge-msg.c             |   11 +++++------
 builtin/merge.c                     |    8 ++++++--
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt
index 14ac466..5954a53 100644
--- a/Documentation/git-fmt-merge-msg.txt
+++ b/Documentation/git-fmt-merge-msg.txt
@@ -25,9 +25,11 @@ OPTIONS
 -------
 
 --log[=<n>]::
-	In addition to branch names, populate the log message with
-	one-line descriptions from at most <n> actual commits that are
-	being merged. If omitted, <n> defaults to 20.
+	Whether to include summaries of merged commits in newly
+	created merge commit messages.  Optionally, an integer can be
+	used to specify how many merged commits to summarize (at
+	maxmium) in the merge message.  Specifying "true" is
+	equivalent to specifying 20.  Defaults to false.
 
 --no-log::
 	Do not list one-line descriptions from the actual commits being
diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt
index b72f533..510c0ad 100644
--- a/Documentation/merge-config.txt
+++ b/Documentation/merge-config.txt
@@ -7,8 +7,12 @@ merge.conflictstyle::
 	marker and the original text before the `=======` marker.
 
 merge.log::
-	Whether to include summaries of merged commits in newly created
-	merge commit messages. False by default.
+	Whether to include summaries of merged commits in newly
+	created merge commit messages.  Optionally, an integer can be
+	used to specify how many merged commits to summarize (at
+	maxmium) in the merge message.  Specifying "true" is
+	equivalent to specifying 20.  Defaults to false. See also
+	linkgit:git-fmt-merge-msg[1].
 
 merge.renameLimit::
 	The number of files to consider when performing rename detection
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 1c5da95..6a2c9c8 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -15,13 +15,12 @@ static int shortlog_len;
 
 static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
 {
-	static int found_merge_log = 0;
-	if (!strcmp("merge.log", key)) {
-		found_merge_log = 1;
-		shortlog_len = git_config_bool(key, value);
+	if (!strcmp(key, "merge.log") || !strcmp(key, "merge.summary")) {
+		int is_bool;
+		shortlog_len = git_config_bool_or_int(key, value, &is_bool);
+		if (is_bool && shortlog_len)
+			shortlog_len = 20;
 	}
-	if (!found_merge_log && !strcmp("merge.summary", key))
-		shortlog_len = git_config_bool(key, value);
 	return 0;
 }
 
diff --git a/builtin/merge.c b/builtin/merge.c
index 994b0c5..78d6c69 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -505,8 +505,12 @@ static int git_merge_config(const char *k, const char *v, void *cb)
 		return git_config_string(&pull_twohead, k, v);
 	else if (!strcmp(k, "pull.octopus"))
 		return git_config_string(&pull_octopus, k, v);
-	else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary"))
-		shortlog_len = git_config_bool(k, v);
+	else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary")) {
+		int is_bool;
+		shortlog_len = git_config_bool_or_int(k, v, &is_bool);
+		if (is_bool && shortlog_len)
+			shortlog_len = 20;
+	}
 	else if (!strcmp(k, "merge.renormalize"))
 		option_renormalize = git_config_bool(k, v);
 	return git_diff_ui_config(k, v, cb);
-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 4/5] fmt-merge-msg: Remove deprecated '--summary' option
  2010-08-22 16:26 [PATCH v5 0/5] merge --log configurability Ramkumar Ramachandra
                   ` (2 preceding siblings ...)
  2010-08-22 16:26 ` [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option Ramkumar Ramachandra
@ 2010-08-22 16:26 ` Ramkumar Ramachandra
  2010-08-22 16:26 ` [PATCH v5 5/5] parse-options: clarify PARSE_OPT_NOARG description Ramkumar Ramachandra
  4 siblings, 0 replies; 13+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-22 16:26 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
	Junio C Hamano

Remove the deprecated '--summary' option that served as a syonym to
the '--log' option. Also update the documentation accordingly.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-fmt-merge-msg.txt |    9 ---------
 Documentation/merge-options.txt     |    5 -----
 builtin/fmt-merge-msg.c             |    5 +----
 builtin/merge.c                     |    2 +-
 4 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt
index 5954a53..a0eb7e2 100644
--- a/Documentation/git-fmt-merge-msg.txt
+++ b/Documentation/git-fmt-merge-msg.txt
@@ -35,11 +35,6 @@ OPTIONS
 	Do not list one-line descriptions from the actual commits being
 	merged.
 
---summary::
---no-summary::
-	Synonyms to --log and --no-log; these are deprecated and will be
-	removed in the future.
-
 -m <message>::
 --message <message>::
 	Use <message> instead of the branch names for the first line
@@ -57,10 +52,6 @@ merge.log::
 	Whether to include summaries of merged commits in newly
 	merge commit messages. False by default.
 
-merge.summary::
-	Synonym to `merge.log`; this is deprecated and will be removed in
-	the future.
-
 SEE ALSO
 --------
 linkgit:git-merge[1]
diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
index 1083f19..8001005 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -67,11 +67,6 @@ option can be used to override --squash.
 	Pass merge strategy specific option through to the merge
 	strategy.
 
---summary::
---no-summary::
-	Synonyms to --stat and --no-stat; these are deprecated and will be
-	removed in the future.
-
 ifndef::git-pull[]
 -q::
 --quiet::
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 6a2c9c8..4255890 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -15,7 +15,7 @@ static int shortlog_len;
 
 static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
 {
-	if (!strcmp(key, "merge.log") || !strcmp(key, "merge.summary")) {
+	if (!strcmp(key, "merge.log")) {
 		int is_bool;
 		shortlog_len = git_config_bool_or_int(key, value, &is_bool);
 		if (is_bool && shortlog_len)
@@ -320,9 +320,6 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 		{ OPTION_INTEGER, 0, "log", &shortlog_len, "n",
 		  "populate log with <n> entries from shortlog",
 		  PARSE_OPT_OPTARG, NULL, 20 },
-		{ OPTION_INTEGER, 0, "summary", &shortlog_len, "n",
-                  "alias for --log (deprecated)",
-		  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },
 		OPT_STRING('m', "message", &message, "text",
 			"use <text> as start of message"),
 		OPT_FILENAME('F', "file", &inpath, "file to read from"),
diff --git a/builtin/merge.c b/builtin/merge.c
index 78d6c69..9196428 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -505,7 +505,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)
 		return git_config_string(&pull_twohead, k, v);
 	else if (!strcmp(k, "pull.octopus"))
 		return git_config_string(&pull_octopus, k, v);
-	else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary")) {
+	else if (!strcmp(k, "merge.log")) {
 		int is_bool;
 		shortlog_len = git_config_bool_or_int(k, v, &is_bool);
 		if (is_bool && shortlog_len)
-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 5/5] parse-options: clarify PARSE_OPT_NOARG description
  2010-08-22 16:26 [PATCH v5 0/5] merge --log configurability Ramkumar Ramachandra
                   ` (3 preceding siblings ...)
  2010-08-22 16:26 ` [PATCH v5 4/5] fmt-merge-msg: Remove deprecated '--summary' option Ramkumar Ramachandra
@ 2010-08-22 16:26 ` Ramkumar Ramachandra
  4 siblings, 0 replies; 13+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-22 16:26 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Johannes Sixt, Jonathan Nieder, Yaroslav Halchenko,
	Junio C Hamano

From: Jonathan Nieder <jrnieder@gmail.com>

Here "takes no argument" means "does not take an argument".  The
latter phrasing might make it clearer that PARSE_OPT_NOARG does not
make an option with an argument that can optionally be left off.

Noticed-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 parse-options.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/parse-options.h b/parse-options.h
index d3b1932..f5ee3a0 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -69,7 +69,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
  * `flags`::
  *   mask of parse_opt_option_flags.
  *   PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs)
- *   PARSE_OPT_NOARG: says that this option takes no argument
+ *   PARSE_OPT_NOARG: says that this option does not take an argument
  *   PARSE_OPT_NONEG: says that this option cannot be negated
  *   PARSE_OPT_HIDDEN: this option is skipped in the default usage, and
  *                     shown only in the full usage.
-- 
1.7.2.2.409.gdbb11.dirty

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len
  2010-08-22 16:26 ` [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len Ramkumar Ramachandra
@ 2010-08-23 22:00   ` Jonathan Nieder
  2010-08-24 17:16     ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Jonathan Nieder @ 2010-08-23 22:00 UTC (permalink / raw)
  To: Ramkumar Ramachandra
  Cc: Git Mailing List, Johannes Sixt, Yaroslav Halchenko,
	Junio C Hamano

Ramkumar Ramachandra wrote:

> Update the API of the fmt_merge_msg function to replace the the
> merge_summary argument with a new shortlog_len argument.

Even more, actually:

> +++ b/builtin.h
> @@ -14,9 +14,8 @@ extern const char git_more_info_string[];
>  extern void list_common_cmds_help(void);
>  extern const char *help_unknown_cmd(const char *cmd);
>  extern void prune_packed_objects(int);
> -extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
> -	struct strbuf *out);
> -extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);
> +extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
> +			 int merge_title, int shortlog_len);

This combines the public functions.  Nice, but probably worth a
mention in the log message.

The API does not make the sense of the merge_title argument clear:
should it be 1 when the caller provides a title or when fmt_merge_msg
should provide one?  There is not much I can see to do about that;
I'd just suggest making it clear in the commit message (so it can
be mentioned in the API docs, once they're written :)).

> @@ -357,9 +354,10 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
>  		die_errno("could not read input file");
>  	if (message) {
>  		strbuf_addstr(&output, message);
> -		ret = fmt_merge_msg_shortlog(&input, &output);
> +		ret = fmt_merge_msg(&input, &output, 0, 20);
>  	} else {
> -		ret = fmt_merge_msg(merge_summary, &input, &output);
> +		ret = fmt_merge_msg(&input, &output, 1,
> +				    merge_summary ? 20 : 0);

Could be further simplified:

	if (message)
		strbuf_addstr(&output, message);
	ret = fmt_merge_msg(&input, &output,
				message ? 0 : 1,
				merge_summary ? 20 : 0);

Not sure if that helps or not.

A part of me wishes that the constant 20 wouldn't be duplicated so much.
Would something like

	#define DEFAULT_MERGE_SHORTLOG_LEN 20

make sense?

> +++ b/builtin/merge.c
> @@ -1014,9 +1014,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>  			merge_name(argv[i], &merge_names);
>  
>  		if (have_message && option_log)
> -			fmt_merge_msg_shortlog(&merge_names, &merge_msg);
> +			fmt_merge_msg(&merge_names, &merge_msg, 0, 20);
>  		else if (!have_message)
> -			fmt_merge_msg(option_log, &merge_names, &merge_msg);
> +			fmt_merge_msg(&merge_names, &merge_msg, 1,
> +				      option_log ? 20: 0);

Likewise.

The rest looks good.  So except for the commit message,

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks.

Here are the cleanups I mentioned.  Except for the #define, they
probably don't belong in this patch.
---
diff --git a/builtin.h b/builtin.h
index 7d18106..09b94ea 100644
--- a/builtin.h
+++ b/builtin.h
@@ -7,6 +7,8 @@
 #include "commit.h"
 #include "notes.h"
 
+#define DEFAULT_MERGE_LOG_LEN 20
+
 extern const char git_version_string[];
 extern const char git_usage_string[];
 extern const char git_more_info_string[];
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 4ed728a..7f06b95 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -352,13 +352,13 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 
 	if (strbuf_read(&input, fileno(in), 0) < 0)
 		die_errno("could not read input file");
-	if (message) {
+
+	if (message)
 		strbuf_addstr(&output, message);
-		ret = fmt_merge_msg(&input, &output, 0, 20);
-	} else {
-		ret = fmt_merge_msg(&input, &output, 1,
-				    merge_summary ? 20 : 0);
-	}
+	ret = fmt_merge_msg(&input, &output,
+			    message ? 0 : 1,
+			    merge_summary ? DEFAULT_MERGE_LOG_LEN : 0);
+
 	if (ret)
 		return ret;
 	write_in_full(STDOUT_FILENO, output.buf, output.len);
diff --git a/builtin/merge.c b/builtin/merge.c
index 70ee412..d797853 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1000,15 +1000,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		for (i = 0; i < argc; i++)
 			merge_name(argv[i], &merge_names);
 
-		if (have_message && option_log)
-			fmt_merge_msg(&merge_names, &merge_msg, 0, 20);
-		else if (!have_message)
-			fmt_merge_msg(&merge_names, &merge_msg, 1,
-				      option_log ? 20: 0);
-
-
-		if (!(have_message && !option_log) && merge_msg.len)
-			strbuf_setlen(&merge_msg, merge_msg.len-1);
+		if (!have_message || option_log) {
+			fmt_merge_msg(&merge_names, &merge_msg, !have_message,
+				      option_log ? DEFAULT_MERGE_LOG_LEN : 0);
+			if (merge_msg.len)
+				strbuf_setlen(&merge_msg, merge_msg.len - 1);
+		}
 	}
 
 	if (head_invalid || !argc)
-- 

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries
  2010-08-22 16:26 ` [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries Ramkumar Ramachandra
@ 2010-08-23 22:25   ` Jonathan Nieder
  2010-08-25  4:50     ` Ramkumar Ramachandra
  0 siblings, 1 reply; 13+ messages in thread
From: Jonathan Nieder @ 2010-08-23 22:25 UTC (permalink / raw)
  To: Ramkumar Ramachandra
  Cc: Git Mailing List, Johannes Sixt, Yaroslav Halchenko,
	Junio C Hamano

Ramkumar Ramachandra wrote:

>  Documentation/git-fmt-merge-msg.txt |   10 +++++-----
>  Documentation/merge-options.txt     |    6 +++---
>  builtin/fmt-merge-msg.c             |   25 ++++++++++++++-----------
>  builtin/merge.c                     |   18 ++++++++++--------
>  4 files changed, 32 insertions(+), 27 deletions(-)

Is this on top of "next"?  I had trouble applying it on top of the
update-contrib-example-merge topic.

> --- a/Documentation/git-fmt-merge-msg.txt
> +++ b/Documentation/git-fmt-merge-msg.txt
> @@ -24,10 +24,10 @@ automatically invoking 'git merge'.
>  OPTIONS
>  -------
>  
> ---log::
> +--log[=<n>]::
>  	In addition to branch names, populate the log message with
> -	one-line descriptions from the actual commits that are being
> -	merged.
> +	one-line descriptions from at most <n> actual commits that are
> +	being merged. If omitted, <n> defaults to 20.

The description feels a bit awkward.  Maybe:

	In addition to branch names, populate the log message with
	one-line descriptions from the actual commits that are being
	merged.  At most <n> commits from each merge parent will be
	used (20 if <n> is omitted).  This overrides the `merge.log`
	configuration variable.

> +++ b/Documentation/merge-options.txt
> @@ -16,11 +16,11 @@ inspect and further tweak the merge result before committing.
>  With --no-ff Generate a merge commit even if the merge
>  resolved as a fast-forward.
>  
> ---log::
> +--log[=<n>]::
>  --no-log::
>  	In addition to branch names, populate the log message with
> -	one-line descriptions from the actual commits that are being
> -	merged.
> +	one-line descriptions from <n> actual commits that are being
> +	merged. See also linkgit:git-fmt-merge-msg[1].

Maybe s/<n>/at most <n>/.

> --- a/builtin/fmt-merge-msg.c
> +++ b/builtin/fmt-merge-msg.c
> @@ -7,21 +7,21 @@
>  #include "string-list.h"
>  
>  static const char * const fmt_merge_msg_usage[] = {
> -	"git fmt-merge-msg [-m <message>] [--log|--no-log] [--file <file>]",
> +	"git fmt-merge-msg [-m <message>] [--log[=<n>]|--no-log] [--file <file>]",
>  	NULL
>  };
>  
> -static int merge_summary;
> +static int shortlog_len;

Before: merge_summary is 1 for --log, 0 for --no-log.
After: shortlog_len is 20 for --log, 0 for --no-log, right?

>  static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
>  {
>  	static int found_merge_log = 0;
>  	if (!strcmp("merge.log", key)) {
>  		found_merge_log = 1;
> -		merge_summary = git_config_bool(key, value);
> +		shortlog_len = git_config_bool(key, value);
>  	}
>  	if (!found_merge_log && !strcmp("merge.summary", key))
> -		merge_summary = git_config_bool(key, value);
> +		shortlog_len = git_config_bool(key, value);

So should this say something like

	shortlog_len = git_config_bool(key, value) ?
				DEFAULT_MERGE_LOG_LEN : 0;

?

> @@ -318,10 +318,12 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
>  	const char *inpath = NULL;
>  	const char *message = NULL;
>  	struct option options[] = {
> -		OPT_BOOLEAN(0, "log",     &merge_summary, "populate log with the shortlog"),
> -		{ OPTION_BOOLEAN, 0, "summary", &merge_summary, NULL,
> -		  "alias for --log (deprecated)",
> -		  PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
> +		{ OPTION_INTEGER, 0, "log", &shortlog_len, "n",
> +		  "populate log with <n> entries from shortlog",
> +		  PARSE_OPT_OPTARG, NULL, 20 },
> +		{ OPTION_INTEGER, 0, "summary", &shortlog_len, "n",
> +                  "alias for --log (deprecated)",
> +		  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },

Whitespace damage.

> +++ b/builtin/merge.c
> @@ -42,7 +42,7 @@ static const char * const builtin_merge_usage[] = {
>  	NULL
>  };
>  
> -static int show_diffstat = 1, option_log, squash;
> +static int show_diffstat = 1, shortlog_len, squash;
>  static int option_commit = 1, allow_fast_forward = 1;
>  static int fast_forward_only;
>  static int allow_trivial = 1, have_message;
> @@ -177,8 +177,9 @@ static struct option builtin_merge_options[] = {
>  	OPT_BOOLEAN(0, "stat", &show_diffstat,
>  		"show a diffstat at the end of the merge"),
>  	OPT_BOOLEAN(0, "summary", &show_diffstat, "(synonym to --stat)"),
> -	OPT_BOOLEAN(0, "log", &option_log,
> -		"add list of one-line log to merge commit message"),
> +	{ OPTION_INTEGER, 0, "log", &shortlog_len, "n",
> +	  "populate log with <n> entries from shortlog",

The emphasis seems wrong: the important thing is still that --log
uses a shortlog, not the number of entries.  Maybe something like

	  "populate log with (at most <n>) entries from shortlog"

but that might make "git merge -h" use more than 80 columns...

>  	OPT_BOOLEAN(0, "commit", &option_commit,
> @@ -505,7 +506,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)
>  	else if (!strcmp(k, "pull.octopus"))
>  		return git_config_string(&pull_octopus, k, v);
>  	else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary"))
> -		option_log = git_config_bool(k, v);
> +		shortlog_len = git_config_bool(k, v);

As before (is this missing a " ? DEFAULT_MERGE_LOG_LEN : 0"?).

Except as noted above,

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len
  2010-08-23 22:00   ` Jonathan Nieder
@ 2010-08-24 17:16     ` Junio C Hamano
  2010-08-25  2:44       ` [PATCH rr/fmt-merge-msg] merge, fmt_merge_msg --log: default value is DEFAULT_MERGE_LOG_LEN Jonathan Nieder
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2010-08-24 17:16 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Ramkumar Ramachandra, Git Mailing List, Johannes Sixt,
	Yaroslav Halchenko

Jonathan Nieder <jrnieder@gmail.com> writes:

> The rest looks good.  So except for the commit message,
>
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks; all of your comments make sense.  Here is what I'll queue.

-- >8 --
From: Ramkumar Ramachandra <artagnon@gmail.com>
Date: Sun, 22 Aug 2010 21:56:34 +0530
Subject: [PATCH] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len

Give "shortlog_len" parameter to the fmt_merge_msg(), remove its
"merge_summary" parameter, and remove fmt_merge_msg_shortlog() function.
In the updated API, shortlog_len == 0 means no shortlog is given.

The parameter "merge_title" controls if the title of the merge commit is
autogenerated (it reads something like "Merge branch ..."), and typically
it is set to true when the caller does not give its own message.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Helped-and-Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin.h               |    7 ++++---
 builtin/fmt-merge-msg.c |   30 ++++++++++++++----------------
 builtin/merge.c         |   14 ++++++--------
 3 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/builtin.h b/builtin.h
index ed6ee26..09b94ea 100644
--- a/builtin.h
+++ b/builtin.h
@@ -7,6 +7,8 @@
 #include "commit.h"
 #include "notes.h"
 
+#define DEFAULT_MERGE_LOG_LEN 20
+
 extern const char git_version_string[];
 extern const char git_usage_string[];
 extern const char git_more_info_string[];
@@ -14,9 +16,8 @@ extern const char git_more_info_string[];
 extern void list_common_cmds_help(void);
 extern const char *help_unknown_cmd(const char *cmd);
 extern void prune_packed_objects(int);
-extern int fmt_merge_msg(int merge_summary, struct strbuf *in,
-	struct strbuf *out);
-extern int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out);
+extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
+			 int merge_title, int shortlog_len);
 extern int commit_notes(struct notes_tree *t, const char *msg);
 
 struct notes_rewrite_cfg {
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 937d5a7..42021d3 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -255,9 +255,9 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
 		strbuf_addf(out, " into %s\n", current_branch);
 }
 
-static int do_fmt_merge_msg(int merge_title, int merge_summary,
-	struct strbuf *in, struct strbuf *out) {
-	int limit = 20, i = 0, pos = 0;
+static int do_fmt_merge_msg(int merge_title, struct strbuf *in,
+	struct strbuf *out, int shortlog_len) {
+	int i = 0, pos = 0;
 	unsigned char head_sha1[20];
 	const char *current_branch;
 
@@ -288,7 +288,7 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,
 	if (merge_title)
 		do_fmt_merge_msg_title(out, current_branch);
 
-	if (merge_summary) {
+	if (shortlog_len) {
 		struct commit *head;
 		struct rev_info rev;
 
@@ -303,17 +303,14 @@ static int do_fmt_merge_msg(int merge_title, int merge_summary,
 
 		for (i = 0; i < origins.nr; i++)
 			shortlog(origins.items[i].string, origins.items[i].util,
-					head, &rev, limit, out);
+					head, &rev, shortlog_len, out);
 	}
 	return 0;
 }
 
-int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
-	return do_fmt_merge_msg(1, merge_summary, in, out);
-}
-
-int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {
-	return do_fmt_merge_msg(0, 1, in, out);
+int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
+		  int merge_title, int shortlog_len) {
+	return do_fmt_merge_msg(merge_title, in, out, shortlog_len);
 }
 
 int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
@@ -355,12 +352,13 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 
 	if (strbuf_read(&input, fileno(in), 0) < 0)
 		die_errno("could not read input file");
-	if (message) {
+
+	if (message)
 		strbuf_addstr(&output, message);
-		ret = fmt_merge_msg_shortlog(&input, &output);
-	} else {
-		ret = fmt_merge_msg(merge_summary, &input, &output);
-	}
+	ret = fmt_merge_msg(&input, &output,
+			    message ? 0 : 1,
+			    merge_summary ? DEFAULT_MERGE_LOG_LEN : 0);
+
 	if (ret)
 		return ret;
 	write_in_full(STDOUT_FILENO, output.buf, output.len);
diff --git a/builtin/merge.c b/builtin/merge.c
index 2207f79..b2c0984 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -998,14 +998,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		for (i = 0; i < argc; i++)
 			merge_name(argv[i], &merge_names);
 
-		if (have_message && option_log)
-			fmt_merge_msg_shortlog(&merge_names, &merge_msg);
-		else if (!have_message)
-			fmt_merge_msg(option_log, &merge_names, &merge_msg);
-
-
-		if (!(have_message && !option_log) && merge_msg.len)
-			strbuf_setlen(&merge_msg, merge_msg.len-1);
+		if (!have_message || option_log) {
+			fmt_merge_msg(&merge_names, &merge_msg, !have_message,
+				      option_log ? DEFAULT_MERGE_LOG_LEN : 0);
+			if (merge_msg.len)
+				strbuf_setlen(&merge_msg, merge_msg.len - 1);
+		}
 	}
 
 	if (head_invalid || !argc)
-- 
1.7.2.2.426.g2251a

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option
  2010-08-22 16:26 ` [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option Ramkumar Ramachandra
@ 2010-08-24 19:01   ` Junio C Hamano
  2010-08-25  3:52     ` Ramkumar Ramachandra
  0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2010-08-24 19:01 UTC (permalink / raw)
  To: Ramkumar Ramachandra
  Cc: Git Mailing List, Johannes Sixt, Jonathan Nieder,
	Yaroslav Halchenko

This makes sense, but I agree with Jonathan's reviews on 1/5 and 2/5, I'll
ask you to reroll this on top of what I'll push out shortly.

As to 4/5, I think we should proceed a lot more carefully than what your
patch does, just like we were extra careful when we went to v1.7.0 than
when we went to v1.6.0 (see release notes to 1.6.6 for a summary,
especially paying attention to the third and the fourth paragraph in
"Preparing yourselves" section).

I've queued 5/5 directly on maint.

Thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH rr/fmt-merge-msg] merge, fmt_merge_msg --log: default value is DEFAULT_MERGE_LOG_LEN
  2010-08-24 17:16     ` Junio C Hamano
@ 2010-08-25  2:44       ` Jonathan Nieder
  0 siblings, 0 replies; 13+ messages in thread
From: Jonathan Nieder @ 2010-08-25  2:44 UTC (permalink / raw)
  To: Ramkumar Ramachandra
  Cc: Junio C Hamano, Git Mailing List, Johannes Sixt,
	Yaroslav Halchenko

Most references to the DEFAULT_MERGE_LOG_LEN were changed to use that
symbolic constant, but a few uses of hardcoded "20" remain.

Cc: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Noticed this while looking over ab6beee (merge: Make '--log' an
integer option) from pu.  Maybe something like it could be squashed in
in the next round.

diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 425900d..bc7c30f 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -323,10 +323,11 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 	struct option options[] = {
 		{ OPTION_INTEGER, 0, "log", &shortlog_len, "n",
 		  "populate log with <n> entries from shortlog",
-		  PARSE_OPT_OPTARG, NULL, 20 },
+		  PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
 		{ OPTION_INTEGER, 0, "summary", &shortlog_len, "n",
 		  "alias for --log (deprecated)",
-		  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL, 20 },
+		  PARSE_OPT_OPTARG | PARSE_OPT_HIDDEN, NULL,
+		  DEFAULT_MERGE_LOG_LEN },
 		OPT_STRING('m', "message", &message, "text",
 			"use <text> as start of message"),
 		OPT_FILENAME('F', "file", &inpath, "file to read from"),
diff --git a/builtin/merge.c b/builtin/merge.c
index bf550a6..9e4733d 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -177,7 +177,7 @@ static struct option builtin_merge_options[] = {
 	OPT_BOOLEAN(0, "summary", &show_diffstat, "(synonym to --stat)"),
 	{ OPTION_INTEGER, 0, "log", &shortlog_len, "n",
 	  "add (at most <n>) entries from shortlog to merge commit message",
-	  PARSE_OPT_OPTARG, NULL, 20 },
+	  PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
 	OPT_BOOLEAN(0, "squash", &squash,
 		"create a single commit instead of doing a merge"),
 	OPT_BOOLEAN(0, "commit", &option_commit,
-- 

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option
  2010-08-24 19:01   ` Junio C Hamano
@ 2010-08-25  3:52     ` Ramkumar Ramachandra
  0 siblings, 0 replies; 13+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-25  3:52 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git Mailing List, Johannes Sixt, Jonathan Nieder,
	Yaroslav Halchenko

Hi Junio,

Junio C Hamano writes:
> This makes sense, but I agree with Jonathan's reviews on 1/5 and 2/5, I'll
> ask you to reroll this on top of what I'll push out shortly.

Thanks! I'll rebase on top of rr/fmt-merge-msg in `pu` and re-roll
later today.

> As to 4/5, I think we should proceed a lot more carefully than what your
> patch does, just like we were extra careful when we went to v1.7.0 than
> when we went to v1.6.0 (see release notes to 1.6.6 for a summary,
> especially paying attention to the third and the fourth paragraph in
> "Preparing yourselves" section).

Ok, I'll look at this and fix the patch accordingly.

> I've queued 5/5 directly on maint.

Right, I saw that.

-- Ram

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries
  2010-08-23 22:25   ` Jonathan Nieder
@ 2010-08-25  4:50     ` Ramkumar Ramachandra
  0 siblings, 0 replies; 13+ messages in thread
From: Ramkumar Ramachandra @ 2010-08-25  4:50 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Git Mailing List, Johannes Sixt, Yaroslav Halchenko,
	Junio C Hamano

Hi Jonathan,

Jonathan Nieder writes:
> Ramkumar Ramachandra wrote:
> 
> >  Documentation/git-fmt-merge-msg.txt |   10 +++++-----
> >  Documentation/merge-options.txt     |    6 +++---
> >  builtin/fmt-merge-msg.c             |   25 ++++++++++++++-----------
> >  builtin/merge.c                     |   18 ++++++++++--------
> >  4 files changed, 32 insertions(+), 27 deletions(-)
> 
> Is this on top of "next"?  I had trouble applying it on top of the
> update-contrib-example-merge topic.
[...]

Due to an unfortunate mistake on my part, it's based on `pu`. I'll fix
all the issues you pointed out and re-roll on top of rr/fmt-merge-msg
later today. Thanks.

-- Ram

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-08-25  4:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-22 16:26 [PATCH v5 0/5] merge --log configurability Ramkumar Ramachandra
2010-08-22 16:26 ` [PATCH v5 1/5] fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_len Ramkumar Ramachandra
2010-08-23 22:00   ` Jonathan Nieder
2010-08-24 17:16     ` Junio C Hamano
2010-08-25  2:44       ` [PATCH rr/fmt-merge-msg] merge, fmt_merge_msg --log: default value is DEFAULT_MERGE_LOG_LEN Jonathan Nieder
2010-08-22 16:26 ` [PATCH v5 2/5] merge: Make '--log' an integer option for number of shortlog entries Ramkumar Ramachandra
2010-08-23 22:25   ` Jonathan Nieder
2010-08-25  4:50     ` Ramkumar Ramachandra
2010-08-22 16:26 ` [PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option Ramkumar Ramachandra
2010-08-24 19:01   ` Junio C Hamano
2010-08-25  3:52     ` Ramkumar Ramachandra
2010-08-22 16:26 ` [PATCH v5 4/5] fmt-merge-msg: Remove deprecated '--summary' option Ramkumar Ramachandra
2010-08-22 16:26 ` [PATCH v5 5/5] parse-options: clarify PARSE_OPT_NOARG description Ramkumar Ramachandra

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).