git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/5] ref-filter: truncate atom names in error messages
Date: Wed, 14 Dec 2022 15:05:05 -0500	[thread overview]
Message-ID: <Y5oscak6T23G81Gu@nand.local> (raw)
In-Reply-To: <Y5n4mb/S/RORb+N7@coredump.intra.peff.net>

On Wed, Dec 14, 2022 at 11:23:53AM -0500, Jeff King wrote:
> It seems like the cleanest fix would be for atom->name to be _just_ the
> name, since there's already a separate "args" field. But since that
> field is also used for other things, we can't change it easily (e.g.,
> it's how we find things in the used_atoms array, and clearly %(refname)
> and %(refname:short) are not the same thing).
>
> Instead, we'll teach our error_bad_arg() function to stop at the first
> ":". This is a little hacky, as we're effectively re-parsing the name,
> but the format is simple enough to do this as a one-liner, and this
> localizes the change to the error-reporting code.
>
> We'll give the same treatment to err_no_arg(). None of its callers use
> this atom->name trick, but it's worth future-proofing it while we're
> here.

For what it's worth, I think that this balance of a somewhat-hacky
implementation against a more significant and trickier refactoring is
well thought-out and the right decision, IMHO.

Thanks,
Taylor

  reply	other threads:[~2022-12-14 20:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 16:18 [PATCH 0/5] minor ref-filter error-reporting bug-fixes Jeff King
2022-12-14 16:18 ` [PATCH 1/5] ref-filter: reject arguments to %(HEAD) Jeff King
2022-12-14 16:19 ` [PATCH 2/5] ref-filter: factor out "%(foo) does not take arguments" errors Jeff King
2022-12-14 19:51   ` Taylor Blau
2022-12-14 20:03     ` Taylor Blau
2022-12-14 20:28     ` Jeff King
2022-12-14 16:20 ` [PATCH 3/5] ref-filter: factor out "unrecognized %(foo) arg" errors Jeff King
2022-12-14 16:23 ` [PATCH 4/5] ref-filter: truncate atom names in error messages Jeff King
2022-12-14 20:05   ` Taylor Blau [this message]
2022-12-14 20:39     ` Jeff King
2022-12-14 16:24 ` [PATCH 5/5] ref-filter: convert email atom parser to use err_bad_arg() Jeff King
2022-12-14 20:05 ` [PATCH 0/5] minor ref-filter error-reporting bug-fixes Taylor Blau

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=Y5oscak6T23G81Gu@nand.local \
    --to=me@ttaylorr.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).