public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "René Scharfe" <l.s.r@web•de>
Cc: Git List <git@vger•kernel.org>
Subject: Re: [PATCH] pretty: avoid double negative in format_commit_item()
Date: Fri, 07 Jul 2023 12:06:37 -0700	[thread overview]
Message-ID: <xmqqcz138rsy.fsf@gitster.g> (raw)
In-Reply-To: <8d4fcad1-5f71-4790-17ee-e9ba0a3118dc@web.de> ("René Scharfe"'s message of "Fri, 7 Jul 2023 20:46:26 +0200")

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.

> 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

      reply	other threads:[~2023-07-07 19:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 18:46 [PATCH] pretty: avoid double negative in format_commit_item() René Scharfe
2023-07-07 19:06 ` Junio C Hamano [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqcz138rsy.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=l.s.r@web$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox