Thread (8 messages) flat view 8 messages, 3 authors, 2016-06-15

Re: Fatal error running status in new repo

From: Jeff King <hidden>
Date: 2016-06-15 22:48:17

On Mon, Feb 15, 2010 at 08:19:45PM -0800, Jacob Helwig wrote:
I just noticed this when creating a new repo for a project.

$ mkdir tmp
$ cd tmp
$ git init
Initialized empty shared Git repository in /home/jhe/projects/tmp/.git/
$ git status
# On branch master
#
# Initial commit
#
warning: ignoring dangling symref HEAD.
fatal: bad revision 'HEAD'
nothing to commit (create/copy files and use "git add" to track)
$ echo $?
0
$ git --version
git version 1.7.0
I can't reproduce it here:

  $ mkdir tmp && cd tmp && git init && git status
  Initialized empty Git repository in /home/peff/tmp/.git/
  # On branch master
  #
  # Initial commit
  #
  nothing to commit (create/copy files and use "git add" to track)

Furthermore, the "ignoring dangling symref" message can only come from
one place (sha1_name.c:285), and is specifically protected by a
conditional making sure that the refname is not "HEAD". Which is just
plain weird.

Do you have anything strange in your ~/.gitconfig? Can you try running
with GIT_TRACE=1 to make sure we are not invoking some sub-command or
something? Did you build git yourself? Can you double-check with a "make
clean && make" that a newly built version exhibits the problem?
Seems a bit silly that "git status" should be issuing warnings, and
fatal errors (especially when the exit code is still 0), when run before
the first commit has been created in a brand new repository.

The warnings make sense if you know what's going on behind the scenes,
but seem like the kind of thing that could scare someone new to git when
they haven't actually done anything wrong at this point.
Agreed. These warnings absolutely should not be shown, but I don't
really understand what is showing them.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help