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

[PATCH v3 2/5] log: honor log.merges= option

From
KKKoosha Khajehmoogahi <koosha@posteo.de>
Date
Apr 13, 2015, 15:29 UTC
Message-ID
<1428938968-19013-2-git-send-email-koosha@posteo.de>
In-Reply-To
<1428938968-19013-1-git-send-email-koosha@posteo.de>
From: Junio C Hamano <gitster@pobox.com>

The config. variable is honored only by log. Other log family commands including show, shortlog and rev-list are affected only from the equivalent command line option (i.e. --merges=). Since these commands are somehow different representations of log command, we like to have the same behavior from them as we do from log itself. However, to not break the default output of them, we do not consider the the config. var. Other log-family commands format-patch and cherry ignore the option altogether (i.e. both on command line and on config settings).

[kk: wrote commit message]
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Koosha Khajehmoogahi <koosha@posteo.de>
---
 builtin/log.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/builtin/log.c b/builtin/log.c
index dd8f3fc..c7a7aad 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -36,6 +36,7 @@ static int decoration_given;
 static int use_mailmap_config;
 static const char *fmt_patch_subject_prefix = "PATCH";
 static const char *fmt_pretty;
+static const char *log_merges;
 
 static const char * const builtin_log_usage[] = {
 	N_("git log [<options>] [<revision range>] [[--] <path>...]"),
@@ -386,6 +387,9 @@ static int git_log_config(const char *var, const char *value, void *cb)
 			decoration_style = 0; /* maybe warn? */
 		return 0;
 	}
+	if (!strcmp(var, "log.merges")) {
+		return git_config_string(&log_merges, var, value);
+	}
 	if (!strcmp(var, "log.showroot")) {
 		default_show_root = git_config_bool(var, value);
 		return 0;
@@ -628,6 +632,8 @@ int cmd_log(int argc, const char **argv, const char *prefix)
 
 	init_revisions(&rev, prefix);
 	rev.always_show_header = 1;
+	if (log_merges && parse_merges_opt(&rev, log_merges))
+		die("unknown config value for log.merges: %s", log_merges);
 	memset(&opt, 0, sizeof(opt));
 	opt.def = "HEAD";
 	opt.revarg_opt = REVARG_COMMITTISH;
-- 
2.3.3.263.g095251d.dirty
Previous: Koosha KhajehmoogahiNext: Junio C Hamano
Message 2 of 12 in “revision: add --merges={show|only|hide} option”
  1. 1/5 revision: add --merges={show|only|hide} optionKoosha Khajehmoogahi, Apr 13, 2015
  2. 2/5 log: honor log.merges= optionKoosha Khajehmoogahi, Apr 13, 2015
  3. Junio C HamanoApr 16, 2015
  4. 3/5 Documentation: add git-log --merges= option and log.merges config. varKoosha Khajehmoogahi, Apr 13, 2015
  5. Eric SunshineApr 14, 2015
  6. Koosha KhajehmoogahiApr 15, 2015
  7. Eric SunshineApr 16, 2015
  8. 4/5 t4202-log: add tests for --merges=Koosha Khajehmoogahi, Apr 13, 2015
  9. Eric SunshineApr 14, 2015
  10. 5/5 bash-completion: add support for git-log --merges= and log.mergesKoosha Khajehmoogahi, Apr 13, 2015
  11. squash! bash-completion: add support for git-log --merges= and log.mergesSZEDER Gábor, Apr 21, 2015
  12. Junio C HamanoApr 21, 2015

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.