#290 new
Kelan Champagne

Silent failure when opening repo with bad remote-head

Reported by Kelan Champagne | December 18th, 2010 @ 10:53 PM

I deleted a remote branch (and pushed the deletion to that remote) that had been my default branch on github (at the time I cloned the repo). Then, the next time I tried to open that repo in GitX, it failed silently, and didn't open the window for the repo. There was no indication as to what went wrong.

The issue was that my git repo was in a slightly bad state. I had a .git/refs/remotes/origin/HEAD file, but it didn't point to a valid branch. This causes git for-each-ref to report a failure. Specifically:

$ git for-each-ref --format='%(refname) %(objecttype) %(objectname) %(*objectname)'
fatal: missing object 0000000000000000000000000000000000000000 for refs/remotes/origin/HEAD

That causes -[PBGitRepository reloadRefs] to fail, printing *** -[NSCFDictionary setObject:forKey:]: attempt to insert nil key to the console. And, from the user's perspective, nothing happens when you try to open that repo in GitX.

You can simulate this condition by putting a bad value in .git/refs/remotes/origin/HEAD.

I have a slight band-aid patch for this (attached as warn-when-bad-ref.diff) that at least shows an alert when this happens, so the user has some idea of what went wrong.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

GitX is the nice-looking gitk clone for OS X

People watching this ticket