git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Glen Choo <chooglen@google.com>
To: Sergey Organov <sorganov@gmail.com>, Junio C Hamano <gitster@pobox.com>
Cc: "Jeff King" <peff@peff.net>,
	"Philip Oakley" <philipoakley@iee.email>,
	"Elijah Newren" <newren@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Alex Henrie" <alexhenrie24@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"huang guanlong" <gl041188@gmail.com>,
	git@vger.kernel.org, "Sergey Organov" <sorganov@gmail.com>
Subject: Re: [PATCH 1/5] diff-merges: implement [no-]hide option and log.diffMergesHide config
Date: Wed, 07 Dec 2022 16:06:58 -0800	[thread overview]
Message-ID: <kl6lfsdqep25.fsf@chooglen-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <20221127093721.31012-2-sorganov@gmail.com>

Sergey Organov <sorganov@gmail.com> writes:

> @@ -49,10 +49,11 @@ ifdef::git-log[]
>  --diff-merges=m:::
>  -m:::
>  	This option makes diff output for merge commits to be shown in
> -	the default format. `-m` will produce the output only if `-p`
> -	is given as well. The default format could be changed using
> +	the default format. The default format could be changed using
>  	`log.diffMerges` configuration parameter, which default value
>  	is `separate`.
> ++
> +	`-m` is a shortcut for '--diff-merges=on --diff-merges=hide'
>  +

I found this description difficult to parse, since

a) it wasn't clear that multiple "--diff-merges" would all be respected
b) I had to read the --diff-merges=hide documentation to understand what
   this means

Keeping the plain english description would help, something like:

  `-m` only produces the output if `-p` is also given, i.e. it is a
  shortcut for '--diff-merges=on --diff-merges=hide'.

> diff --git a/builtin/log.c b/builtin/log.c
> index 56e2d95e869d..e031021e53b2 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -581,6 +581,8 @@ static int git_log_config(const char *var, const char *value, void *cb)
>  	}
>  	if (!strcmp(var, "log.diffmerges"))
>  		return diff_merges_config(value);
> +	if (!strcmp(var, "log.diffmergeshide"))
> +		return diff_merges_hide_config(git_config_bool(var, value));
>  	if (!strcmp(var, "log.showroot")) {
>  		default_show_root = git_config_bool(var, value);
>  		return 0;

Since we have log.diffmergeshide that is different from log.diffmerges,
it seems like it would be more consistent to have '--diff-merges-hide'
as a separate flag.

> @@ -69,6 +87,10 @@ static diff_merges_setup_func_t func_by_opt(const char *optarg)
>  {
>  	if (!strcmp(optarg, "off") || !strcmp(optarg, "none"))
>  		return set_none;
> +	if (!strcmp(optarg, "hide"))
> +		return set_hide;
> +	if (!strcmp(optarg, "no-hide"))
> +		return set_no_hide;
>  	if (!strcmp(optarg, "1") || !strcmp(optarg, "first-parent"))
>  		return set_first_parent;
>  	if (!strcmp(optarg, "separate"))
> @@ -105,7 +127,19 @@ int diff_merges_config(const char *value)
>  	if (!func)
>  		return -1;
>  
> -	set_to_default = func;
> +	if (func == set_hide)
> +		hide = 1;
> +	else if (func == set_no_hide)
> +		hide = 0;
> +	else
> +		set_to_default = func;
> +
> +	return 0;
> +}

The code is also simpler if we took a separate CLI flag, e.g. we could
get rid of this special casing of "(func == X)".

  reply	other threads:[~2022-12-08  0:07 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-27  9:37 [PATCH 0/5] diff-merges: more features Sergey Organov
2022-11-27  9:37 ` [PATCH 1/5] diff-merges: implement [no-]hide option and log.diffMergesHide config Sergey Organov
2022-12-08  0:06   ` Glen Choo [this message]
2022-12-08 18:13     ` Sergey Organov
2022-11-27  9:37 ` [PATCH 2/5] diff-merges: implement log.diffMerges-m-imply-p config Sergey Organov
2022-11-27  9:37 ` [PATCH 3/5] diff-merges: implement log.diffMergesForce config Sergey Organov
2022-11-28  2:35   ` Junio C Hamano
2022-11-28 14:44     ` Sergey Organov
2022-11-29 15:30       ` Junio C Hamano
2022-11-29 17:59         ` Ævar Arnfjörð Bjarmason
2022-11-30 13:01           ` Sergey Organov
2022-11-30 13:28           ` Junio C Hamano
2022-11-29 18:48       ` Jeff King
2022-11-30 13:02         ` Sergey Organov
2022-11-29  5:10   ` Elijah Newren
2022-11-30 12:58     ` Sergey Organov
2022-11-27  9:37 ` [PATCH 4/5] diff-merges: support list of values for --diff-merges Sergey Organov
2022-11-27  9:37 ` [PATCH 5/5] diff-merges: issue warning on lone '-m' option Sergey Organov
2022-11-28  7:51 ` [PATCH 0/5] diff-merges: more features Junio C Hamano
2022-11-28 14:42   ` Sergey Organov
2022-11-29  4:50 ` Elijah Newren
2022-11-30 13:16   ` Sergey Organov
2022-12-01  2:21     ` Elijah Newren
2022-12-01  9:36       ` Sergey Organov
2022-12-07 23:55 ` Glen Choo
2022-12-08 14:29   ` Sergey Organov
2022-12-08 23:05     ` Glen Choo
2022-12-10 20:45       ` Sergey Organov
2022-12-08 23:06     ` Glen Choo
2022-12-08 16:18   ` Sergey Organov
2022-12-17 13:29   ` [PATCH v1 0/5] diff-merges: more features to fix '-m' Sergey Organov
2022-12-17 13:29     ` [PATCH v1 1/5] diff-merges: implement [no-]hide option and log.diffMergesHide config Sergey Organov
2022-12-17 13:29     ` [PATCH v1 2/5] diff-merges: implement log.diffMerges-m-imply-p config Sergey Organov
2022-12-17 13:29     ` [PATCH v1 3/5] diff-merges: support list of values for --diff-merges Sergey Organov
2022-12-17 13:29     ` [PATCH v1 4/5] diff-merges: issue warning on lone '-m' option Sergey Organov
2022-12-17 13:29     ` [PATCH v1 5/5] diff-merges: improve --diff-merges documentation Sergey Organov
2022-12-18  3:10     ` [PATCH v1 0/5] diff-merges: more features to fix '-m' Junio C Hamano
2022-12-19 14:22       ` Sergey Organov
2022-12-19 14:29       ` Sergey Organov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=kl6lfsdqep25.fsf@chooglen-macbookpro.roam.corp.google.com \
    --to=chooglen@google.com \
    --cc=alexhenrie24@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=gl041188@gmail.com \
    --cc=jrnieder@gmail.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.email \
    --cc=sorganov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).