git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, sluongng@gmail.com, me@ttaylorr.com,
	Derrick Stolee <dstolee@microsoft.com>
Subject: Re: [PATCH v2] log: add log.excludeDecoration config option
Date: Thu, 16 Apr 2020 08:36:50 -0400	[thread overview]
Message-ID: <681fc3a9-9402-44a0-dc73-56c8ad14ba47@gmail.com> (raw)
In-Reply-To: <xmqqblns7j4u.fsf@gitster.c.googlers.com>

On 4/15/2020 1:29 PM, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> Hmph.  Do we still need "found" here?  If there are include patterns
>> given explicitly from the command line, a ref MUST match one of them
>> in order to be included, and a ref that matches one of them will be
>> included no matter that exclude config says.
>>
>> So shouldn't the updated logic for the include patterns part be more
>> like ...
> 
> I still think that the two clean-ups I mentioned are both worth
> doing, but without them, but with the simplification of the code 
> I suggested, the resulting helper becomes like this, which I think
> is quite easy to understand.  It seems to pass t4202, which you
> updated, too.
> 
> 
> 
> int ref_filter_match(const char *refname,
> 		     const struct string_list *include_patterns,
> 		     const struct string_list *exclude_patterns,
> 		     const struct string_list *exclude_patterns_config)
> {
> 	struct string_list_item *item;
> 
> 	if (exclude_patterns && exclude_patterns->nr) {
> 		for_each_string_list_item(item, exclude_patterns) {
> 			if (match_ref_pattern(refname, item))
> 				return 0;
> 		}
> 	}
> 
> 	if (include_patterns && include_patterns->nr) {
> 		for_each_string_list_item(item, include_patterns) {
> 			if (match_ref_pattern(refname, item)) {
> 				return 1;
> 			}
> 		}
> 		return 0;
> 	}
> 
> 	if (exclude_patterns_config && exclude_patterns_config->nr) {
> 		for_each_string_list_item(item, exclude_patterns_config) {
> 			if (match_ref_pattern(refname, item))
> 				return 0;
> 		}
> 	}
> 
> 	return 1;
> }

This reorganization of the code is much cleaner, and it can
guide cleaning up the documentation comment in the header file.

I see you included it in a SQUASH??? commit, which I will squash
into my branch for v3.

Thanks,
-Stolee



  reply	other threads:[~2020-04-16 12:37 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
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 [this message]
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=681fc3a9-9402-44a0-dc73-56c8ad14ba47@gmail.com \
    --to=stolee@gmail.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.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).