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