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

Re: [PATCH 5/6] fetch: utilize rejected ref error details

From
Karthik Nayak <karthik.188@gmail.com>
Date
Jan 15, 2026, 15:20 UTC
Message-ID
<CAOLa=ZQ0ETE+SzRV+M-xzEQFRTjdhSMseHjwnJ314yqPw8BPYA@mail.gmail.com>
In-Reply-To
<20260114180040.GH885771@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 40 quoted lines
> On Wed, Jan 14, 2026 at 04:40:46PM +0100, Karthik Nayak wrote:
>
>> @@ -1674,9 +1674,11 @@ static void ref_transaction_rejection_handler(const char *refname,
>>  			"branches"), data->remote_name);
>>  		data->conflict_msg_shown = true;
>>  	} else {
>> -		const char *reason = ref_transaction_error_msg(err);
>> -
>> -		error(_("fetching ref %s failed: %s"), refname, reason);
>> +		if (details)
>> +			error("%s", details);
>> +		else
>> +			error(_("fetching ref %s failed: %s"),
>> +			      refname, ref_transaction_error_msg(err));
>>  	}
>
> OK, so here we're writing to stderr anyway, and now we'll just give the
> more detailed data. Makes sense (though like Junio, I do wonder if the
> existing message might provide more details in some cases).
>
> BTW, I think there is still a related fallout for git-fetch. Even with
> your patch, doing this:
>
>   $ 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'
>
> will not put anything in the status table. Whereas in v2.50.0 and
> earlier, we get:
>
>   $ 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)
>
> Note the "!" and the "unable to update local ref" message in the status
> table.
>
> -Peff

This one is a bit harder to crack, earlier we were getting reference update results right as we added individual updates. Now that information is only received at the end when it is committed, we just don't have that information.

One way is to delay this output until we commit everything. But we don't want to iterate over refs unnecessarily, so probably store these in a list, and then iterate over them.

I'll try and add a patch for this too. Thanks for reporting.
Previous: Jeff KingNext: Karthik Nayak
Message 21 of 32 in “refs: provide detailed error messages when using batched update”
  1. 0/6 refs: provide detailed error messages when using batched updateKarthik Nayak, Jan 14, 2026
  2. 1/6 refs: remove unused headerKarthik Nayak, Jan 14, 2026
  3. Junio C HamanoJan 14, 2026
  4. Karthik NayakJan 15, 2026
  5. 2/6 refs: attach rejection details to updatesKarthik Nayak, Jan 14, 2026
  6. Jeff KingJan 14, 2026
  7. Karthik NayakJan 15, 2026
  8. Jeff KingJan 15, 2026
  9. Karthik NayakJan 16, 2026
  10. 3/6 refs: add rejection detail to the callback functionKarthik Nayak, Jan 14, 2026
  11. Jeff KingJan 14, 2026
  12. Karthik NayakJan 15, 2026
  13. 4/6 update-ref: utilize rejected error details if availableKarthik Nayak, Jan 14, 2026
  14. Junio C HamanoJan 14, 2026
  15. Jeff KingJan 14, 2026
  16. Karthik NayakJan 15, 2026
  17. 5/6 fetch: utilize rejected ref error detailsKarthik Nayak, Jan 14, 2026
  18. Junio C HamanoJan 14, 2026
  19. Karthik NayakJan 15, 2026
  20. Jeff KingJan 14, 2026
  21. Karthik NayakJan 15, 2026
  22. 6/6 receive-pack: utilize rejected ref error detailsKarthik Nayak, Jan 14, 2026
  23. Jeff KingJan 14, 2026
  24. Karthik NayakJan 15, 2026
  25. Junio C HamanoJan 14, 2026
  26. 0/6 refs: provide detailed error messages when using batched updateKarthik Nayak, Jan 25, 2026
  27. 1/6 refs: skip to next ref when current ref is rejectedKarthik Nayak, Jan 25, 2026
  28. 2/6 refs: add rejection detail to the callback functionKarthik Nayak, Jan 25, 2026
  29. 3/6 update-ref: utilize rejected error details if availableKarthik Nayak, Jan 25, 2026
  30. 4/6 fetch: utilize rejected ref error detailsKarthik Nayak, Jan 25, 2026
  31. 5/6 receive-pack: utilize rejected ref error detailsKarthik Nayak, Jan 25, 2026
  32. 6/6 fetch: delay user information post committing of transactionKarthik Nayak, Jan 25, 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.