Previously, we would try to copy the view selector from within
the RepositoryWindow, so we could reuse it and change it if we
need to.
However, that causes problems if you have another window open:
if we try to add an item using the insertItemWithIdentifier:atIndex:
method, the item will be added to _all_ toolbars with the same
identifier, even if those toolbars already have the item!
As I see no easy way to fix that, we completely avoid the issue
by not inserting any objects and just copying the view selector
from view to view.
This changes a lot of code, so quick review:
* RepositoryDocumentController now returns the document without selecting a ref
* PBGitWindowController now optionally shows the default view, or selects no view at all
* PBGitRepository keeps a pointer to its WindowController so that it can change views
This used to be bound to the UserDefaults, but that introduced the
bug that switching the view in one window also switched it in other
open windows.
See 2e7cd5268d