{"thread":{"id":"59960","subject":"[PATCH] pretty: avoid double negative in format_commit_item()","startedAt":"2023-07-07T18:46:32Z","lastAt":"2023-07-07T19:06:56Z","messageCount":2,"participants":["René Scharfe","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"479289","messageId":"8d4fcad1-5f71-4790-17ee-e9ba0a3118dc@web.de","threadId":"59960","inReplyTo":null,"subject":"[PATCH] pretty: avoid double negative in format_commit_item()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2023-07-07T18:46:26Z","receivedAt":"2023-07-07T18:46:32Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Test for equality with no_flush, which has enough negation already.  Get\nrid of the unnecessary parentheses while at it.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n pretty.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 7862be105d..81cdc9f2cd 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1855,10 +1855,10 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */\n \t}\n\n \torig_len = sb->len;\n-\tif ((context)->flush_type != no_flush)\n-\t\tconsumed = format_and_pad_commit(sb, placeholder, context);\n-\telse\n+\tif (context->flush_type == no_flush)\n \t\tconsumed = format_commit_one(sb, placeholder, context);\n+\telse\n+\t\tconsumed = format_and_pad_commit(sb, placeholder, context);\n \tif (magic == NO_MAGIC)\n \t\treturn consumed;\n\n--\n2.41.0\n"},{"id":"479291","messageId":"xmqqcz138rsy.fsf@gitster.g","threadId":"59960","inReplyTo":"8d4fcad1-5f71-4790-17ee-e9ba0a3118dc@web.de","subject":"Re: [PATCH] pretty: avoid double negative in format_commit_item()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-07-07T19:06:37Z","receivedAt":"2023-07-07T19:06:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> Test for equality with no_flush, which has enough negation already.  Get\n> rid of the unnecessary parentheses while at it.\n\nMakes sense.  This double negation was with us since a5752342\n(pretty: support padding placeholders, %< %> and %><, 2013-04-19),\nthat is more than 10 years old ;-)\n\nWill queue.\n\nThanks.\n\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n>  pretty.c | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/pretty.c b/pretty.c\n> index 7862be105d..81cdc9f2cd 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -1855,10 +1855,10 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */\n>  \t}\n>\n>  \torig_len = sb->len;\n> -\tif ((context)->flush_type != no_flush)\n> -\t\tconsumed = format_and_pad_commit(sb, placeholder, context);\n> -\telse\n> +\tif (context->flush_type == no_flush)\n>  \t\tconsumed = format_commit_one(sb, placeholder, context);\n> +\telse\n> +\t\tconsumed = format_and_pad_commit(sb, placeholder, context);\n>  \tif (magic == NO_MAGIC)\n>  \t\treturn consumed;\n>\n> --\n> 2.41.0\n"}]}