git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, sluongng@gmail.com,
	Derrick Stolee <dstolee@microsoft.com>
Subject: Re: [PATCH] log: add log.excludeDecoration config option
Date: Tue, 14 Apr 2020 10:19:34 -0700	[thread overview]
Message-ID: <xmqqeesq9e8p.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <pull.610.git.1586791720114.gitgitgadget@gmail.com> (Derrick Stolee via GitGitGadget's message of "Mon, 13 Apr 2020 15:28:39 +0000")

"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  	if (decoration_style) {
> +		const struct string_list *config_exclude =
> +			repo_config_get_value_multi(the_repository,
> +						    "log.excludeDecoration");
> +
> +		if (config_exclude) {
> +			struct string_list_item *item;
> +			for (item = config_exclude->items;
> +			     item && item < config_exclude->items + config_exclude->nr;
> +			     item++)
> +				string_list_append(&decorate_refs_exclude,
> +						item->string);
> +		}
> +
>  		rev->show_decorations = 1;
> +
>  		load_ref_decorations(&decoration_filter, decoration_style);
>  	}

A few random thoughts.  Unlike my other usual reviews, please do not
take "should we do X" as a suggestion (these are purely me wondering
and nothing more at this point):

 * Given that we have command line options to specify what patterns
   to include as well as to exclude, it feels somewhat asymmetric to
   have only the configuration to exclude.  Should we also have a
   configuration for including?

 * The new code only adds to decorate_refs_exclude, which has the
   patterns that were given with the "--decorate-refs-exclude"
   command line option.  As refs.c:ref_filter_match() rejects
   anything that match an exclude pattern first before looking at
   the include patterns, there is no way to countermand what is
   configured to be excluded with the configuration from the command
   line, even with --decorate-refs" option.  Should we have a new
   command line option to "clear" the exclude list read from the
   configuration?  And if we add configuration for including for
   symmetry, should that be cleared as well?

 * As this is a multi-valued configuration, there probably are cases
   where you have configured three patterns, and for this single
   invocation you would want to override only one of them.  It might
   not be usable if the only way to override were to "clear" with a
   new option and then add two that you want from the command line.

What if we had (configured) exclusion for X, Y and Z, and then
allowed the command line to say "include Y", that would result in
the combination to specify exclusion of X and Z only?  Can we get
away by not having "include these" configuration at all, perhaps,
because "if there is no inclusion pattern, anything that does not
match exclusion patterns is included" is how the matcher works?

I guess the last one, despite what I said upfront, is the beginning
of my suggestion.  If we take the quoted change as-is, and then
before load_ref_decorations() uses the decoration_filter, perhaps we
can see for each pattern in the "exclude" list, if there is the same
entry in the "include" list, and remove it from both lists.  That
way, when the users wonder why their "git log" does not use certain
refs to decorate (let's say, you configured "refs/heads/*" in the
exclusion list), they can countermand by giving "--decorate-refs"
from the command line, perhaps?  It is still unclear to me how well
such a scheme works, e.g. how should patterns "refs/tags/*" and
"refs/tags/*-rc*" interact when they are given as configs and
options to include/exclude in various permutations, though.

Thanks.




  parent reply	other threads:[~2020-04-14 17:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 15:28 [PATCH] log: add log.excludeDecoration config option Derrick Stolee via GitGitGadget
2020-04-13 15:49 ` Taylor Blau
2020-04-14 15:10   ` Derrick Stolee
2020-04-14 15:45     ` Taylor Blau
2020-04-14 16:00       ` Derrick Stolee
2020-04-14 17:19 ` Junio C Hamano [this message]
2020-04-14 17:49   ` Derrick Stolee
2020-04-14 18:10     ` Junio C Hamano
2020-04-15 14:14       ` Derrick Stolee
2020-04-15 15:44 ` [PATCH v2] " Derrick Stolee via GitGitGadget
2020-04-15 16:52   ` Taylor Blau
2020-04-15 17:24   ` Junio C Hamano
2020-04-15 17:29     ` Junio C Hamano
2020-04-16 12:36       ` Derrick Stolee
2020-04-16 12:46     ` Derrick Stolee
2020-04-16 14:15   ` [PATCH v3 0/2] " Derrick Stolee via GitGitGadget
2020-04-16 14:15     ` [PATCH v3 1/2] log-tree: make ref_filter_match() a helper method Derrick Stolee via GitGitGadget
2020-04-16 14:15     ` [PATCH v3 2/2] log: add log.excludeDecoration config option Derrick Stolee via GitGitGadget
2020-04-16 17:49       ` Junio C Hamano
2020-04-16 18:03         ` Junio C Hamano
2020-04-17  1:53           ` Derrick Stolee
2020-04-17  2:01             ` Junio C Hamano

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=xmqqeesq9e8p.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=sluongng@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).