git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v5 3/5] merge: Make 'merge.log' an integer or boolean option

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Aug 22, 2010, 16:26 UTC
Message-ID
<1282494398-20542-4-git-send-email-artagnon@gmail.com>
In-Reply-To
<1282494398-20542-1-git-send-email-artagnon@gmail.com>

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
Previous: Ramkumar RamachandraNext: Junio C Hamano
Message 9 of 13 in “merge --log configurability”
  1. 0/5 merge --log configurabilityRamkumar Ramachandra, Aug 22, 2010
  2. 1/5 fmt_merge_msg: Change fmt_merge_msg API to accept shortlog_lenRamkumar Ramachandra, Aug 22, 2010
  3. Jonathan NiederAug 23, 2010
  4. Junio C HamanoAug 24, 2010
  5. merge, fmt_merge_msg --log: default value is DEFAULT_MERGE_LOG_LENJonathan Nieder, Aug 25, 2010
  6. 2/5 merge: Make '--log' an integer option for number of shortlog entriesRamkumar Ramachandra, Aug 22, 2010
  7. Jonathan NiederAug 23, 2010
  8. Ramkumar RamachandraAug 25, 2010
  9. 3/5 merge: Make 'merge.log' an integer or boolean optionRamkumar Ramachandra, Aug 22, 2010
  10. Junio C HamanoAug 24, 2010
  11. Ramkumar RamachandraAug 25, 2010
  12. 4/5 fmt-merge-msg: Remove deprecated '--summary' optionRamkumar Ramachandra, Aug 22, 2010
  13. 5/5 parse-options: clarify PARSE_OPT_NOARG descriptionRamkumar Ramachandra, Aug 22, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.