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

Re: [PATCH] push: don't guess at qualifying remote refs on deletion

From
Jeff King <peff@peff.net>
Date
Jul 4, 2012, 07:37 UTC
Message-ID
<20120704073758.GA23473@sigill.intra.peff.net>
In-Reply-To
<7vipe4vdnh.fsf@alter.siamese.dyndns.org>
On Tue, Jul 03, 2012 at 12:38:10PM -0700, Junio C Hamano wrote:
Show 28 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > Instead, we can just be more succinct and say "we can't
> > delete this because we couldn't find it". So before:
> >
> >   $ git push origin :bogus
> >   error: unable to push to unqualified destination: bogus
> >   The destination refspec neither matches an existing ref on the remote nor
> >   begins with refs/, and we are unable to guess a prefix based on the source ref.
> >   error: failed to push some refs to '$URL'
> >
> > and now:
> >
> >   $ git push origin :bogus
> >   error: unable to delete 'bogus': remote ref does not exist
> >   error: failed to push some refs to '$URL'
> 
> This is telling a truth ($GIT_DIR/refs/bogus does not exist) but not
> the whole truth; while I tend to agree that it is better than the
> original (especially with ", and we are unable to guess..." part),
> given that the above request would delete refs/tags/bogus or
> refs/heads/bogus if they existed on the "origin", I am a bit worried
> that it may send an incorrect message to novice users.
> 
>     unable to delete 'bogus': no branch or tag with that name
> 
> might allay my worries, but I am not extremely happy with that
> wording, either.

I think the most accurate explanation of the behavior is "the destination refspec does not match an existing ref, and it is not fully qualified, so I didn't know what you meant to delete". But that is a pretty awful message (only slightly less awful than the original one, but I think that one is pretty bad).

The really interesting part is that we tried to match "bogus" against all of the usual ref lookup rules, and it didn't match anything. But we have the same issue when we say "git show bogus" and it does not match anything, and we simply say "bad revision 'bogus'".

Maybe:
  unable to delete 'bogus': no matching remote ref found
would be a reasonably short way of saying that?

That still leaves out the second half, that it was not fully qualified and therefore we could not even transmit an attempt to delete (even though that attempt would clearly not succeed!). But that is really not a subtlety that I think is worth putting in the error message, as it is way more likely to confuse somebody.

-Peff
Previous: Junio C HamanoNext: Andreas Schwab
Message 11 of 17 in “How do I delete a remote branch with a period in the name?”
  1. jonsmirl@gmail.comJul 3, 2012
  2. Junio C HamanoJul 3, 2012
  3. jonsmirl@gmail.comJul 3, 2012
  4. push: don't guess at qualifying remote refs on deletionJeff King, Jul 3, 2012
  5. jonsmirl@gmail.comJul 3, 2012
  6. Jeff KingJul 3, 2012
  7. jonsmirl@gmail.comJul 3, 2012
  8. Jeff KingJul 3, 2012
  9. Carlos Martín NietoJul 4, 2012
  10. Junio C HamanoJul 3, 2012
  11. Jeff KingJul 4, 2012
  12. Andreas SchwabJul 3, 2012
  13. Junio C HamanoJul 3, 2012
  14. Carlos Martín NietoJul 5, 2012
  15. Phil HordJul 5, 2012
  16. Carlos Martín NietoJul 5, 2012
  17. Junio C HamanoJul 5, 2012

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.