public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* Possible regression: lost diagnostic message when pushing non-commit objects to refs/heads/*
@ 2025-12-24  3:32 Elijah Newren
  2025-12-24  3:37 ` Junio C Hamano
  2025-12-24  8:12 ` Jeff King
  0 siblings, 2 replies; 6+ messages in thread
From: Elijah Newren @ 2025-12-24  3:32 UTC (permalink / raw)
  To: Git Mailing List, Karthik Nayak; +Cc: Jeff King, Patrick Steinhardt

Hi,

git used to have better diagnostics about pushing non-commit objects
to refs/heads/*, dating all the way back to c3b0dec509fe (Be more
careful about updating refs, 2008-01-15):

$ git --version && git push . tagit:old
git version 2.50.1
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
remote: error: cannot update ref 'refs/heads/old': trying to write
non-commit object d19968fcf0d3193147b827c9e89668d619afd01e to branch
'refs/heads/old'
To .
 ! [remote rejected] tagit -> old (failed to update ref)
error: failed to push some refs to '.'

Unfortunately, the "trying to write non-commit object" error is no longer shown:

$ git --version && git push . tagit:old
git version 2.51.0
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To .
 ! [remote rejected] tagit -> old (invalid new value provided)
error: failed to push some refs to '.'

The relevant error message is still part of the code:
$ git grep "write non-commit object" -- '*.c'
refs/files-backend.c:                           "trying to write
non-commit object %s to branch '%s'",
refs/reftable-backend.c:                        strbuf_addf(err,
_("trying to write non-commit object %s to branch '%s'"),

but the error message isn't displayed.  Bisecting shows that this
started with commit 9d2962a7c44 ("receive-pack: use batched reference
updates", 2025-05-19).  That commit message to me suggests that while
error handling was necessarily changed, that dropping the errors was
not intentional:

```
As using batched updates requires the error handling to be moved to the
end of the flow, create and use a 'struct strset' to track the failed
refs and attribute the correct errors to them.
```

But it's possible I'm reading it wrong.  Was it intentional, or is
this a regression?

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-12-27  7:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-24  3:32 Possible regression: lost diagnostic message when pushing non-commit objects to refs/heads/* Elijah Newren
2025-12-24  3:37 ` Junio C Hamano
2025-12-24  8:12 ` Jeff King
2025-12-24  8:21   ` Jeff King
2025-12-26 16:48   ` Karthik Nayak
2025-12-27  7:44     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox