From: Jeff King Date: Wed, 14 Jan 2026 18:00:40 GMT Subject: Re: [PATCH 5/6] fetch: utilize rejected ref error details Message-ID: <20260114180040.GH885771@coredump.intra.peff.net> In-Reply-To: <20260114-633-regression-lost-diagnostic-message-when-pushing-non-commit-objects-to-refs-heads-v1-5-f5f8b173c501@gmail.com> 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