Skip to content

Commit

Permalink
Make branchesAlwaysIncludedRegex parameter not required (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetersen authored Feb 9, 2024
1 parent fca1f2c commit de45e0b
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.Util;
import hudson.util.ListBoxModel;
import java.util.regex.Pattern;
import jenkins.scm.api.SCMHead;
Expand All @@ -23,6 +24,7 @@
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;

/**
* A {@link Discovery} trait for GitLab that will discover branches on the repository.
Expand All @@ -49,12 +51,10 @@ public class BranchDiscoveryTrait extends SCMSourceTrait {
* Constructor for stapler.
*
* @param strategyId the strategy id.
* @param branchesAlwaysIncludedRegex the branchesAlwaysIncludedRegex.
*/
@DataBoundConstructor
public BranchDiscoveryTrait(int strategyId, String branchesAlwaysIncludedRegex) {
public BranchDiscoveryTrait(int strategyId) {
this.strategyId = strategyId;
this.branchesAlwaysIncludedRegex = branchesAlwaysIncludedRegex;
}

/**
Expand Down Expand Up @@ -85,6 +85,14 @@ public String getBranchesAlwaysIncludedRegex() {
return branchesAlwaysIncludedRegex;
}

/**
* Sets the branchesAlwaysIncludedRegex.
*/
@DataBoundSetter
public void setBranchesAlwaysIncludedRegex(@CheckForNull String branchesAlwaysIncludedRegex) {
this.branchesAlwaysIncludedRegex = Util.fixEmptyAndTrim(branchesAlwaysIncludedRegex);
}

Check warning on line 94 in src/main/java/io/jenkins/plugins/gitlabbranchsource/BranchDiscoveryTrait.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 56-94 are not covered by tests

/**
* Returns the compiled {@link Pattern} of the branchesAlwaysIncludedRegex.
*
Expand Down

0 comments on commit de45e0b

Please sign in to comment.