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

Re: [PATCH v2 7/7] fetch: delay user information post committing of transaction

From
Karthik Nayak <karthik.188@gmail.com>
Date
Jan 19, 2026, 16:11 UTC
Message-ID
<CAOLa=ZRwErG0wBb8ia7NbfnSOmWcx2_7WS0vL2rJTtXeJaJ9kA@mail.gmail.com>
In-Reply-To
<0082426c-a945-4f2e-969e-897e1aeaed66@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 43 quoted lines
> Hi Karthik
>
> On 16/01/2026 21:27, Karthik Nayak wrote:
>> In Git 2.50 and earlier, we would display failure codes and error
>> message as part of the status display:
>>
>>    $ git 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)
>>
>> With the addition of batched updates, this information is no longer
>> shown to the user:
>>
>>    $ git fetch . v1.0.0:refs/heads/foo
>>      From .
>>       * [new tag]               v1.0.0     -> foo
>>      error: cannot update ref 'refs/heads/foo': trying to write non-commit object f665776185ad074b236c00751d666da7d1977dbe to branch 'refs/heads/foo'
>>
>> Since reference updates are batched and processed together at the end,
>> information around the outcome is not available during individual
>> reference parsing.
>>
>> To overcome this, collate and delay the output to the end. Introduce
>> `ref_update_display_info` which will hold individual update's
>> information and also whether the update failed or succeeded. This
>> finally allows us to iterate over all such updates and print them to the
>> user. While this brings back the functionality, it does change the order
>> of the output. Modify the tests to reflect this.
>
> It is unfortunate that a fix for a regression the the messages changes
> the order of those messages. It is doubly unfortunate that the new order
> depends on the implementation of strmap_for_each() which may change in
> the future. I think you can avoid this by appending each update to an
> array in update_local_ref() and adding the errors to a separate strmap
> in ref_transaction_rejection_handler(). Then when you come to print the
> massages, loop over the array and for each update lookup the ref in the
> strmap to see if it failed before printing the appropriate message.
>
> Thanks
>
> Phillip
>

Yes, I think there is merit in the approach you suggested, it ensures that all messages are delayed (avoiding the split between displaying a few at the beginning vs some at the end) and that they retain the order. I have a version cooking locally which does this and works correctly. I'll send it in with my next version.

Thanks, Karthik

Previous: Phillip Wood
Message 12 of 12 in “refs: provide detailed error messages when using batched update”
  1. 0/7 refs: provide detailed error messages when using batched updateKarthik Nayak, Jan 16, 2026
  2. 1/7 refs: drop unnecessary header includesKarthik Nayak, Jan 16, 2026
  3. SZEDER GáborJan 18, 2026
  4. Karthik NayakJan 19, 2026
  5. 2/7 refs: skip to next ref when current ref is rejectedKarthik Nayak, Jan 16, 2026
  6. 3/7 refs: add rejection detail to the callback functionKarthik Nayak, Jan 16, 2026
  7. 4/7 update-ref: utilize rejected error details if availableKarthik Nayak, Jan 16, 2026
  8. 5/7 fetch: utilize rejected ref error detailsKarthik Nayak, Jan 16, 2026
  9. 6/7 receive-pack: utilize rejected ref error detailsKarthik Nayak, Jan 16, 2026
  10. 7/7 fetch: delay user information post committing of transactionKarthik Nayak, Jan 16, 2026
  11. Phillip WoodJan 17, 2026
  12. Karthik NayakJan 19, 2026

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.