THe Bom version can have a dash not a dot
This commit is contained in:
@@ -233,8 +233,13 @@ public class ProjectGitHandler implements ReleaserPropertiesAware {
|
||||
// exists. If not, then we will assume that `master` contains it
|
||||
private String branchFromVersion(String version) {
|
||||
// 2.3.4.RELEASE -> 2.3.4
|
||||
// 2.3.4-RELEASE -> 2.3.4
|
||||
// Camden.RELEASE -> Camden
|
||||
String versionTillPatch = version.substring(0, version.lastIndexOf("."));
|
||||
// Camden-SR -> Camden
|
||||
int indexOfDot = version.lastIndexOf(".");
|
||||
int indexOfDash = version.indexOf("-");
|
||||
int indexToPick = indexOfDot > 0 ? indexOfDot : indexOfDash;
|
||||
String versionTillPatch = version.substring(0, indexToPick);
|
||||
// 2.3.4 -> [2,3,4]
|
||||
// Camden -> [Camden]
|
||||
String[] splitVersion = versionTillPatch.split("\\.");
|
||||
|
||||
@@ -161,6 +161,29 @@ public class ProjectGitHandlerTests {
|
||||
then(this.gitRepo).should().checkout("Finchley");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_check_out_a_branch_if_it_exists_when_cloning_from_org_and_its_a_release_train_version_with_a_dash() {
|
||||
this.properties.getFixedVersions().put("spring-cloud-release", "Finchley-SR6");
|
||||
given(this.gitRepo.hasBranch(anyString())).willReturn(false);
|
||||
given(this.gitRepo.hasBranch("Finchley")).willReturn(true);
|
||||
|
||||
this.updater.cloneProjectFromOrg("spring-cloud-release");
|
||||
|
||||
then(this.gitRepo).should().checkout("Finchley");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_check_out_a_branch_if_it_exists_when_cloning_from_org_and_its_a_release_train_version_with_at_least_one_dash() {
|
||||
this.properties.getFixedVersions().put("spring-cloud-release",
|
||||
"Finchley-BUILD-SNAPSHOT");
|
||||
given(this.gitRepo.hasBranch(anyString())).willReturn(false);
|
||||
given(this.gitRepo.hasBranch("Finchley")).willReturn(true);
|
||||
|
||||
this.updater.cloneProjectFromOrg("spring-cloud-release");
|
||||
|
||||
then(this.gitRepo).should().checkout("Finchley");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_not_check_out_a_branch_if_it_does_not_exist_when_cloning_and_guessing_branch() {
|
||||
given(this.gitRepo.hasBranch(anyString())).willReturn(true);
|
||||
|
||||
Reference in New Issue
Block a user