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

Re: [PATCH 4/5] ref-filter: truncate atom names in error messages

From
Taylor Blau <me@ttaylorr.com>
Date
Dec 14, 2022, 20:05 UTC
Message-ID
<Y5oscak6T23G81Gu@nand.local>
In-Reply-To
<Y5n4mb/S/RORb+N7@coredump.intra.peff.net>
On Wed, Dec 14, 2022 at 11:23:53AM -0500, Jeff King wrote:
Show 14 quoted lines
> 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

Previous: Jeff KingNext: Jeff King
Message 9 of 12 in “minor ref-filter error-reporting bug-fixes”
  1. 0/5 minor ref-filter error-reporting bug-fixesJeff King, Dec 14, 2022
  2. 1/5 ref-filter: reject arguments to %(HEAD)Jeff King, Dec 14, 2022
  3. 2/5 ref-filter: factor out "%(foo) does not take arguments" errorsJeff King, Dec 14, 2022
  4. Taylor BlauDec 14, 2022
  5. Taylor BlauDec 14, 2022
  6. Jeff KingDec 14, 2022
  7. 3/5 ref-filter: factor out "unrecognized %(foo) arg" errorsJeff King, Dec 14, 2022
  8. 4/5 ref-filter: truncate atom names in error messagesJeff King, Dec 14, 2022
  9. Taylor BlauDec 14, 2022
  10. Jeff KingDec 14, 2022
  11. 5/5 ref-filter: convert email atom parser to use err_bad_arg()Jeff King, Dec 14, 2022
  12. Taylor BlauDec 14, 2022

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.