Return either "" or "NameBasedFilter" for branchFilterName depending on the old value of allowAllBranches for jobs where branchFilterName is null (fixes #202)

This commit is contained in:
Robin Müller 2016-02-27 13:29:58 +01:00
parent 6d8fa91fb6
commit 49c505544d
1 changed files with 10 additions and 1 deletions

View File

@ -84,6 +84,7 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
private boolean addNoteOnMergeRequest = true;
private boolean addCiMessage = false;
private boolean addVoteOnMergeRequest = true;
private transient boolean allowAllBranches = false;
private final String branchFilterName;
private final String includeBranchesSpec;
private final String excludeBranchesSpec;
@ -198,7 +199,15 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
return false;
}
public String getBranchFilterName() { return this.branchFilterName; }
// TODO use an enum instead of a String for this
public String getBranchFilterName() {
// TODO move this to a migration method during code cleanup
if (branchFilterName == null) {
return allowAllBranches ? "" : "NameBasedFilter";
} else {
return branchFilterName;
}
}
public String getIncludeBranchesSpec() {
return this.includeBranchesSpec == null ? "" : this.includeBranchesSpec;