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

Re: [PATCH v3 2/2] log: add log.excludeDecoration config option

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 16, 2020, 17:49 UTC
Message-ID
<xmqqo8rrz5gn.fsf@gitster.c.googlers.com>
In-Reply-To
<96c865e9214802021f8e991d2194b7aea6cd6bba.1587046549.git.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 24 quoted lines
> diff --git a/log-tree.c b/log-tree.c
> index ab6d29a746b..fd3fd3316a1 100644
> --- a/log-tree.c
> +++ b/log-tree.c
> @@ -103,6 +103,8 @@ static int ref_filter_match(const char *refname,
>  	struct string_list_item *item;
>  	const struct string_list *exclude_patterns = filter->exclude_ref_pattern;
>  	const struct string_list *include_patterns = filter->include_ref_pattern;
> +	const struct string_list *exclude_patterns_config =
> +				filter->exclude_ref_config_pattern;
>  
>  	if (exclude_patterns && exclude_patterns->nr) {
>  		for_each_string_list_item(item, exclude_patterns) {
> @@ -112,17 +114,21 @@ static int ref_filter_match(const char *refname,
>  	}
>  
>  	if (include_patterns && include_patterns->nr) {
> -		int found = 0;
>  		for_each_string_list_item(item, include_patterns) {
>  			if (match_ref_pattern(refname, item)) {
> -				found = 1;
> -				break;
> +				return 1;
>  			}
Micronit.  

Let's mimick the early return in the loop above (for command line excludes) and below (for configured excludes), each of which is just a single "return" statement in a block without {braces} around.

Other than that, looks nicely done.
The new tests are really appreciated, too.
Previous: Derrick Stolee via GitGitGadgetNext: Junio C Hamano
Message 18 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.