git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] drop trailing newline from warning/error/die messages
Date: Thu, 05 Sep 2024 08:18:36 -0700	[thread overview]
Message-ID: <xmqqfrqe5dtf.fsf@gitster.g> (raw)
In-Reply-To: <20240905085149.GA2340826@coredump.intra.peff.net> (Jeff King's message of "Thu, 5 Sep 2024 04:51:49 -0400")

Jeff King <peff@peff.net> writes:

> Our error reporting routines append a trailing newline, and the strings
> we pass to them should not include them (otherwise we get an extra blank
> line after the message).
>
> These cases were all found by looking at the results of:
>
>   git grep -P '[^_](error|error_errno|warning|die|die_errno)\(.*\\n"[,)]' '*.c'
>
> Note that we _do_ sometimes include a newline in the middle of such
> messages, to create multiline output (hence our grep matching "," or ")"
> after we see the newline, so we know we're at the end of the string).
>
> It's possible that one or more of these cases could intentionally be
> including a blank line at the end, but having looked at them all
> manually, I think these are all just mistakes.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> I just happened to notice one of these, so I grepped for more.

Just like what a good developer would do ;-)  Thanks.

I am a bit surprised (and feel somewhat relieved) that no tests try
to match the messages exactly (with test_cmp, not with test_grep).

      parent reply	other threads:[~2024-09-05 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05  8:51 [PATCH] drop trailing newline from warning/error/die messages Jeff King
2024-09-05 10:57 ` Patrick Steinhardt
2024-09-06  3:54   ` Jeff King
2024-09-05 15:18 ` 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=xmqqfrqe5dtf.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).