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

Re: Minor bug report

From
Jeff King <peff@peff.net>
Date
Jun 4, 2015, 08:21 UTC
Message-ID
<20150604082125.GA5771@peff.net>
In-Reply-To
<1433345954.21083.14.camel@kaarsemaker.net>
On Wed, Jun 03, 2015 at 05:39:14PM +0200, Dennis Kaarsemaker wrote:
Show 22 quoted lines
> On di, 2015-06-02 at 23:48 -0700, Junio C Hamano wrote:
> > 
> > I am kind of surprised after reading these two threads that my
> > take on this issue has changed over time, as my knee-jerk
> > reaction before reading them was the opposite, something
> > along the lines of "This is only immediately after 'git init'; why
> > bother?". Or depending on my mood, that "How stupid do you
> > have to be..." sounds exactly like a message I may advocate
> > for us to send. Perhaps I grew more bitter with age.
> 
> The "fatal: Failed to resolve 'HEAD' as a valid ref." message, closely
> related to the "fatal: bad default revision 'HEAD'" message that started
> this thread just came by in #git with the following situation:
> 
> $ git init
> $ git add .
> # Oops, didn't want to add foo.xyz
> $ git reset foo.xyz
> fatal: Failed to resolve 'HEAD' as a valid ref.
> 
> The solution there is simple, git rm --cached, but I think git could
> produce more helpful messages when a repo is empty.

Yeah, I think there are a lot of places we could handle unborn branches better. We've slowly been smoothing these rough edges over the years (usually by using the empty tree when we wanted HEAD to be a tree-ish).

Patches welcome. :)
-Peff
Previous: Dennis Kaarsemaker
Message 11 of 11 in “Minor bug report”
  1. Tummala DhanviJun 3, 2015
  2. Jeff KingJun 3, 2015
  3. Junio C HamanoJun 3, 2015
  4. log: diagnose empty HEAD more clearlyJeff King, Jun 3, 2015
  5. Junio C HamanoJun 3, 2015
  6. Stefan NäweJun 4, 2015
  7. Jeff KingJun 4, 2015
  8. Jeff KingJun 4, 2015
  9. Junio C HamanoJun 5, 2015
  10. Dennis KaarsemakerJun 3, 2015
  11. Jeff KingJun 4, 2015

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.