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

Re: [PATCH] pretty: avoid double negative in format_commit_item()

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2023, 19:06 UTC
Message-ID
<xmqqcz138rsy.fsf@gitster.g>
In-Reply-To
<8d4fcad1-5f71-4790-17ee-e9ba0a3118dc@web.de>
René Scharfe <l.s.r@web.de> writes:
> Test for equality with no_flush, which has enough negation already.  Get
> rid of the unnecessary parentheses while at it.

Makes sense. This double negation was with us since a5752342 (pretty: support padding placeholders, %< %> and %><, 2013-04-19), that is more than 10 years old ;-)

Will queue.
Thanks.
Show 25 quoted lines
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
>  pretty.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/pretty.c b/pretty.c
> index 7862be105d..81cdc9f2cd 100644
> --- a/pretty.c
> +++ b/pretty.c
> @@ -1855,10 +1855,10 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */
>  	}
>
>  	orig_len = sb->len;
> -	if ((context)->flush_type != no_flush)
> -		consumed = format_and_pad_commit(sb, placeholder, context);
> -	else
> +	if (context->flush_type == no_flush)
>  		consumed = format_commit_one(sb, placeholder, context);
> +	else
> +		consumed = format_and_pad_commit(sb, placeholder, context);
>  	if (magic == NO_MAGIC)
>  		return consumed;
>
> --
> 2.41.0
Previous: René Scharfe
Message 2 of 2 in “pretty: avoid double negative in format_commit_item()”
  1. pretty: avoid double negative in format_commit_item()René Scharfe, Jul 7, 2023
  2. Junio C HamanoJul 7, 2023

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.