Do not display "[NO-HEAD]" for empty repository
commitd9700cf14f6ffafdb58cdc8087e664159efdefc0
authorThomas Wolf <thomas.wolf@paranor.ch>
Thu, 31 May 2018 20:26:12 +0000 (31 22:26 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 4 Jun 2018 20:53:32 +0000 (4 22:53 +0200)
treebe509497a2d4622a0aad8635d28e23b90a04ad0f
parentcdda987e0ddfbb0ef3b617c5b78fc08cd80888d5
Do not display "[NO-HEAD]" for empty repository

After a new repository has been created, its "master" branch is an
unborn branch. EGit showed "NO-HEAD" in the decorations for this case.

This is confusing for novices and looks like something went wrong. The
canonical implementation shows after "git init; git status": "On branch
master" and "Initial commit".

So let's display "master" in this case, too. Reserve the "NO-HEAD" for
cases where there is really no HEAD.

Also show such a HEAD in the repositories view under "References" and
decorate it as "[master] unborn; will be created by commit". Limit
showing such a HEAD to the repositories view: the content provider is
used in other places where such a HEAD node would only cause confusion
or malfunctioning. Use an extension factory to create the content
provider for the repositories view; in this way the new behavior can be
enabled there only without having to touch all the other places where
this content provider is used. Adapt the label provider to handle the
new case, and ensure that the history page doesn't get confused and
broken if HEAD is such an unborn branch.

In the staging view, use the  the warning message label above the
commit message text area to tell the user that this commit will
create the still unborn branch.

Bug: 533596
Change-Id: Ifd0547a156f0a5616ce7e032ea8daebd2596f31e
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java
org.eclipse.egit.ui/plugin.xml
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/ToggleableWarningLabel.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewContentProvider.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewExtensionFactory.java [new file with mode: 0644]
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesViewLabelProvider.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/ToggleableLabel.java [new file with mode: 0644]
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties