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

Re: [PATCH v2] log: add log.excludeDecoration config option

From
Derrick Stolee <stolee@gmail.com>
Date
Apr 16, 2020, 12:36 UTC
Message-ID
<681fc3a9-9402-44a0-dc73-56c8ad14ba47@gmail.com>
In-Reply-To
<xmqqblns7j4u.fsf@gitster.c.googlers.com>
On 4/15/2020 1:29 PM, Junio C Hamano wrote:
Show 50 quoted lines
> 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

Previous: Junio C HamanoNext: Derrick Stolee
Message 14 of 22 in “log: add log.excludeDecoration config option”
  1. log: add log.excludeDecoration config optionDerrick Stolee via GitGitGadget, Apr 13, 2020
  2. Taylor BlauApr 13, 2020
  3. Derrick StoleeApr 14, 2020
  4. Taylor BlauApr 14, 2020
  5. Derrick StoleeApr 14, 2020
  6. Junio C HamanoApr 14, 2020
  7. Derrick StoleeApr 14, 2020
  8. Junio C HamanoApr 14, 2020
  9. Derrick StoleeApr 15, 2020
  10. log: add log.excludeDecoration config optionDerrick Stolee via GitGitGadget, Apr 15, 2020
  11. Taylor BlauApr 15, 2020
  12. Junio C HamanoApr 15, 2020
  13. Junio C HamanoApr 15, 2020
  14. Derrick StoleeApr 16, 2020
  15. Derrick StoleeApr 16, 2020
  16. 0/2 log: add log.excludeDecoration config optionDerrick Stolee via GitGitGadget, Apr 16, 2020
  17. 2/2 log: add log.excludeDecoration config optionDerrick Stolee via GitGitGadget, Apr 16, 2020
  18. Junio C HamanoApr 16, 2020
  19. Junio C HamanoApr 16, 2020
  20. Derrick StoleeApr 17, 2020
  21. Junio C HamanoApr 17, 2020
  22. 1/2 log-tree: make ref_filter_match() a helper methodDerrick Stolee via GitGitGadget, Apr 16, 2020

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.