git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [GSoC] Add configuration options for some commonly used command-line options
@ 2015-03-15 19:29 Koosha Khajehmoogahi
  2015-03-15 19:35 ` Koosha Khajehmoogahi
  2015-03-15 20:24 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Koosha Khajehmoogahi @ 2015-03-15 19:29 UTC (permalink / raw)
  To: git

This patch adds a 'showmerges' config. option for git-log.
This option determines whether the log should contain merge
commits or not. In essence, if this option is set to true,
git-log will be run as 'git-log --no-merges'.

Signed-off-by: Koosha Khajehmoogahi <koosha@posteo.de>
---
 Documentation/config.txt | 3 +++
 builtin/log.c            | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 1530255..7775b8c 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1735,6 +1735,9 @@ log.showroot::
 	Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which
 	normally hide the root commit will now show it. True by default.
 
+log.showmerges::
+	If true, merges will be shown in the log list. True by default.
+
 log.mailmap::
 	If true, makes linkgit:git-log[1], linkgit:git-show[1], and
 	linkgit:git-whatchanged[1] assume `--use-mailmap`.
diff --git a/builtin/log.c b/builtin/log.c
index dd8f3fc..bb36f61 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -31,6 +31,7 @@ static const char *default_date_mode = NULL;
 
 static int default_abbrev_commit;
 static int default_show_root = 1;
+static int default_max_parents = -1;
 static int decoration_style;
 static int decoration_given;
 static int use_mailmap_config;
@@ -108,6 +109,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)
 	rev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
 	rev->abbrev_commit = default_abbrev_commit;
 	rev->show_root_diff = default_show_root;
+	rev->max_parents = default_max_parents;
 	rev->subject_prefix = fmt_patch_subject_prefix;
 	DIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);
 
@@ -390,6 +392,12 @@ static int git_log_config(const char *var, const char *value, void *cb)
 		default_show_root = git_config_bool(var, value);
 		return 0;
 	}
+
+	if (!strcmp(var, "log.showmerges")) {
+		default_max_parents = git_config_bool(var, value) ? -1 : 1;
+		return 0;
+	}
+
 	if (skip_prefix(var, "color.decorate.", &slot_name))
 		return parse_decorate_color_config(var, slot_name, value);
 	if (!strcmp(var, "log.mailmap")) {
-- 
1.9.1

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

* Re: [PATCH] [GSoC] Add configuration options for some commonly used command-line options
  2015-03-15 19:29 [PATCH] [GSoC] Add configuration options for some commonly used command-line options Koosha Khajehmoogahi
@ 2015-03-15 19:35 ` Koosha Khajehmoogahi
  2015-03-15 20:24 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Koosha Khajehmoogahi @ 2015-03-15 19:35 UTC (permalink / raw)
  To: git



On 03/15/2015 08:29 PM, Koosha Khajehmoogahi wrote:
> This patch adds a 'showmerges' config. option for git-log.
> This option determines whether the log should contain merge
> commits or not. In essence, if this option is set to true,

Sorry, this should be 'false'.

> git-log will be run as 'git-log --no-merges'.
> 
> Signed-off-by: Koosha Khajehmoogahi <koosha@posteo.de>
> ---
>  Documentation/config.txt | 3 +++
>  builtin/log.c            | 8 ++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 1530255..7775b8c 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1735,6 +1735,9 @@ log.showroot::
>  	Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which
>  	normally hide the root commit will now show it. True by default.
>  
> +log.showmerges::
> +	If true, merges will be shown in the log list. True by default.
> +
>  log.mailmap::
>  	If true, makes linkgit:git-log[1], linkgit:git-show[1], and
>  	linkgit:git-whatchanged[1] assume `--use-mailmap`.
> diff --git a/builtin/log.c b/builtin/log.c
> index dd8f3fc..bb36f61 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -31,6 +31,7 @@ static const char *default_date_mode = NULL;
>  
>  static int default_abbrev_commit;
>  static int default_show_root = 1;
> +static int default_max_parents = -1;
>  static int decoration_style;
>  static int decoration_given;
>  static int use_mailmap_config;
> @@ -108,6 +109,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)
>  	rev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
>  	rev->abbrev_commit = default_abbrev_commit;
>  	rev->show_root_diff = default_show_root;
> +	rev->max_parents = default_max_parents;
>  	rev->subject_prefix = fmt_patch_subject_prefix;
>  	DIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);
>  
> @@ -390,6 +392,12 @@ static int git_log_config(const char *var, const char *value, void *cb)
>  		default_show_root = git_config_bool(var, value);
>  		return 0;
>  	}
> +
> +	if (!strcmp(var, "log.showmerges")) {
> +		default_max_parents = git_config_bool(var, value) ? -1 : 1;
> +		return 0;
> +	}
> +
>  	if (skip_prefix(var, "color.decorate.", &slot_name))
>  		return parse_decorate_color_config(var, slot_name, value);
>  	if (!strcmp(var, "log.mailmap")) {
> 

-- 
Koosha

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

* Re: [PATCH] [GSoC] Add configuration options for some commonly used command-line options
  2015-03-15 19:29 [PATCH] [GSoC] Add configuration options for some commonly used command-line options Koosha Khajehmoogahi
  2015-03-15 19:35 ` Koosha Khajehmoogahi
@ 2015-03-15 20:24 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2015-03-15 20:24 UTC (permalink / raw)
  To: Koosha Khajehmoogahi; +Cc: git

Koosha Khajehmoogahi <koosha@posteo.de> writes:

> This patch adds a 'showmerges' config. option for git-log.
> This option determines whether the log should contain merge
> commits or not. In essence, if this option is set to true,
> git-log will be run as 'git-log --no-merges'.
>
> Signed-off-by: Koosha Khajehmoogahi <koosha@posteo.de>
> ---
>  Documentation/config.txt | 3 +++
>  builtin/log.c            | 8 ++++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 1530255..7775b8c 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1735,6 +1735,9 @@ log.showroot::
>  	Tools like linkgit:git-log[1] or linkgit:git-whatchanged[1], which
>  	normally hide the root commit will now show it. True by default.
>  
> +log.showmerges::
> +	If true, merges will be shown in the log list. True by default.

When you have to help your colleague by inspecting the history in
her repository, and your colleague has this set to false, and you do
want your "git log" to show merge commits, how would you override
this setting?

	git log --merges

is not it.

Avoid introducing a configuration that users cannot override it from
the command line.  If there is a way to override (and for the
purpose of this discussion, "git -c log.showmerges=yes" does not
count), document it here.

Tests need to make sure that (1) with configuration without command
line override, the various settings of the variable give behaviour
you wanted to give, and (2) with configuration with command line
override, the values set to the variable does not have any effect to
the behaviour (i.e. the command line override wins).

Thanks.

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

end of thread, other threads:[~2015-03-15 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-15 19:29 [PATCH] [GSoC] Add configuration options for some commonly used command-line options Koosha Khajehmoogahi
2015-03-15 19:35 ` Koosha Khajehmoogahi
2015-03-15 20:24 ` Junio C Hamano

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 NNTP newsgroup(s).