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

Re: Possible regression: lost diagnostic message when pushing non-commit objects to refs/heads/*

From
Jeff King <peff@peff.net>
Date
Dec 24, 2025, 08:21 UTC
Message-ID
<20251224082116.GA1946629@coredump.intra.peff.net>
In-Reply-To
<20251224081214.GA1879908@coredump.intra.peff.net>
On Wed, Dec 24, 2025 at 03:12:14AM -0500, Jeff King wrote:
Show 16 quoted lines
> But in the new batched world that allows partial-batch failures, we
> throw it away. The problem (at least for the files backend) is this code
> in files_transaction_prepare():
> 
>           ret = lock_ref_for_update(refs, update, i, transaction,
>                                     head_ref, &refnames_to_check,
>                                     err);
>           if (ret) {
>                   if (ref_transaction_maybe_set_rejected(transaction, i, ret)) {
>                           strbuf_reset(err);
>                           ret = 0;
> 
>                           continue;
>                   }
>                   goto cleanup;
>           }

BTW, you found the regression via receive-pack, but as you can see here it is really a problem for any batched ref-update caller that sets the ALLOW_FAILURE flag. So the original sin is not from the commit you found via bisect, but 23fc8e4f61 (refs: implement batch reference update support, 2025-04-08). And it affects fetch, too:

  $ git.v2.50.0 fetch . v1.0.0:refs/heads/foo
  error: cannot update ref 'refs/heads/foo': trying to write non-commit object f665776185ad074b236c00751d666da7d1977dbe to branch 'refs/heads/foo'
  From .
   ! [new tag]               v1.0.0     -> foo  (unable to update local ref)
  $ git.v2.51.0 fetch . v1.0.0:refs/heads/foo
  From .
   * [new tag]               v1.0.0     -> foo
  error: fetching ref refs/heads/foo failed: invalid new value provided

Actually, I think there is another bug lurking there for fetch. We do not even mark the failure in the status output anymore!

And I guess "update-ref --batch-updates" suffers from the same lack of detail:

  $ echo create refs/heads/foo v1.0.0 | git update-ref --batch-updates --stdin
  rejected refs/heads/foo f665776185ad074b236c00751d666da7d1977dbe 0000000000000000000000000000000000000000 invalid new value provided

though it is not technically a regression since the option to ask for ALLOW_FAILURE did not even exist before --batch-updates. It would be nice if it gave more details (whether to stderr or in the machine-readable output).

-Peff
Previous: Jeff KingNext: Karthik Nayak
Message 4 of 6 in “Possible regression: lost diagnostic message when pushing non-commit objects to refs/heads/*”
  1. Elijah NewrenDec 24, 2025
  2. Junio C HamanoDec 24, 2025
  3. Jeff KingDec 24, 2025
  4. Jeff KingDec 24, 2025
  5. Karthik NayakDec 26, 2025
  6. Jeff KingDec 27, 2025

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.