DESCRIPTION

Fixed: Specifying non-existing master does not abort initialization

- abort init operation if master is missing
- added validator for missing master branch
- ask user to create master branch
- ask user to create initial commit if repository is empty
- added control decorations to hint at source of problem
- adjusted tests

Bug: 475788
Change-Id: Ief9b1a361a3dce83358e7b84034bb6a477ec92e4
Signed-off-by: Jamarion Hunt xxx@xxx.xxx

COMMENTS

author: Jamarion Hunt
date: 2015-09-09 22:53:36.000000000

Uploaded patch set 4.

-------------------------------------
author: Brenden Conley
date: 2015-09-09 22:53:42.000000000

Patch Set 4:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/7569/

-------------------------------------
author: Brenden Conley
date: 2015-09-09 23:18:53.000000000

Patch Set 4: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/7569/ : UNSTABLE

-------------------------------------
author: Jamarion Hunt
date: 2015-09-09 23:20:43.000000000

Patch Set 4:

> (1 comment)
 > 
 > found this problem:
 > - create new Java project
 > - share it with git team provider and create a repository
 > - click "init gitflow" (repository is still empty, HEAD doesn't
 > exist yet)
 > - in "Initialize repository" dialog choose non-default master
 > branch e.g. master1
 > - gitflow warns that this master branch doesn't exist and asks if I
 > want to create it
 > - click yes
 > - this hits the following exception
 > 
 > org.eclipse.egit.gitflow.WrongGitFlowStateException: Git flow
 > repository may not be empty.
 > at org.eclipse.egit.gitflow.GitFlowRepository.findHead(GitFlowRepository.java:147)
 > at org.eclipse.egit.gitflow.ui.internal.dialogs.InitDialog.okPressed(InitDialog.java:281)
 > ... 62 more
 > 
 > - the error is not shown in an error dialog but ends up in the
 > error log only, so I
 > can't leave the "Initialize repository" dialog until I click
 > "Cancel"
 > - if initializing a gitflow repository requires HEAD then the
 > action "Init Git Flow"
 > should be disabled if HEAD doesn't exist / repository is empty
 > - or "Init Git Flow" should work on empty repository
 > - don't know how native gitflow handles this
 
I created a new UI test for this case and fixed it with another question to the user. Yes, the reference implementation works on empty repositories.
Thanks for testing this so thoroughly!

 > - if I first create an initial commit the dialog works and I can
 > create the
 > non-standard "master1" branch but then I already have a "master"
 > branch and
 > have to delete that (I want the non-standard master1 branch and why
 > should I
 > also use a master branch ?), so it looks like it would be better to
 > rename
 > master to master1 instead of creating both.

I think that in some scenarios this would make sense, but we have to keep in mind that the Gitflow "master" has a very specific semantic. It's the branch that always points to the latest release. The Git master branch does not have this semantic.
Also my guess is that in most cases, when users want to convert their repository to Gitflow, it would make more sense to turn the existing master into develop (e.g. the EGit repository).

-------------------------------------
author: Douglas Trujillo
date: 2015-09-09 23:28:02.000000000

Patch Set 4:

(1 comment)

Line:50, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/uitext.properties -> you should mention that this first commit will be empty, or open the commit dialog so that the user can choose if he wants to add some content for the first commit

-------------------------------------
author: Jamarion Hunt
date: 2015-09-10 08:30:25.000000000

Patch Set 4:

(1 comment)

Line:50, org.eclipse.egit.gitflow.ui/src/org/eclipse/egit/gitflow/ui/internal/uitext.properties -> Done

-------------------------------------
author: Gerrit Johnathan Pham
date: 2015-09-10 11:46:35.000000000

Change has been successfully merged into the git repository by Douglas Trujillo

-------------------------------------
