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
$ git for-each-ref --format='%(refname) %(objecttype) %(objectname) %(*objectname)' fatal: missing object 0000000000000000000000000000000000000000 for refs/remotes/origin/HEAD
-[PBGitRepository reloadRefs] to fail,
*** -[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
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