// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/core/RuleContext.java
// public interface RuleContext {
// 
//     @Nonnull
//     MutableSemVersion getVersion();
// 
// 
//     default void setVersion(SemVersion version) {
//         getVersion().setFrom(version);
//     }
// 
// 
//     default void setVersion(String versionString) {
//         getVersion().setFrom(versionString);
//     }
// 
//     /**
//      * Gets the Gradle project.
//      *
//      * @return the Gradle {@link Project}
//      */
//     @Nonnull
//     Project getProject();
// 
//     /**
//      * Gets the Git repository.
//      *
//      * @return the {@link GitRepository}
//      */
//     @Nonnull
//     GitRepository getRepository();
// 
//     /**
//      * Gets the current HEAD commit.
//      *
//      * @return the current HEAD as a {@link GitCommit}, or {@code null} if the repository is empty
//      */
//     @Nullable
//     default GitCommit getHead() {
//         return getRepository().getHead();
//     }
// 
//     boolean isSkipOtherRules();
// 
//     void setSkipOtherRules(boolean skipOtherRules);
// 
//     @Nullable
//     default GitBranch getCurrentBranch() {
//         return getRepository().getCurrentBranch();
//     }
// 
//     /**
//      * Gets the <em>short</em> name of the current branch, i.e. the branch that the HEAD points to.
//      * Returns {@code null} if the repository is in "detached head" state.
//      *
//      * <p>The short branch name does not include the {@code refs/heads/} prefix.</p>
//      *
//      * @return the short name of the current branch
//      */
//     @Nullable
//     default String getBranchName() {
//         GitBranch branch = getCurrentBranch();
//         return branch != null ? branch.getShortName() : null;
//     }
// 
// 
//     @Nullable
//     default BranchPoint branchPoint() {
//         String masterBranch = Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + Constants.MASTER;
//         return branchPoint(masterBranch);
//     }
// 
// 
//     @Nullable
//     default BranchPoint branchPoint(String... otherBranchNames) {
//         return new GitOperations(getRepository()).branchPoint(otherBranchNames);
//     }
// 
// 
//     @Nullable
//     default BranchPoint branchPoint(Pattern otherBranchNamePattern) {
//         return new GitOperations(getRepository()).branchPoint(otherBranchNamePattern);
//     }
// 
// 
//     default int countCommitsSince(HasObjectId obj) {
//         return countCommitsSince(obj, false);
//     }
// 
// 
//     default int countCommitsSince(HasObjectId obj, boolean countMergeCommits) {
//         return new GitOperations(getRepository()).countCommitsSince(obj, countMergeCommits);
//     }
// 
// 
//     @Nullable
//     default TaggedCommit findLatestTag(Pattern tagNamePattern, boolean includeMerges) {
//         return new GitOperations(getRepository()).findLatestTag(tagNamePattern, includeMerges);
//     }
// 
// 
//     @Nullable
//     default TaggedCommit findLatestTag(Pattern tagNamePattern) {
//         return findLatestTag(tagNamePattern, true);
//     }
// }
// 
// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/model/GitBranch.java
// public interface GitBranch {
// 
//     @Nonnull
//     String getShortName();
// 
//     @Nonnull
//     String getFullName();
// 
//     @Nonnull
//     GitCommit getHead();
// }


import javax.annotation.Nonnull;
import org.gradle.api.Action;
import org.unbrokendome.gradle.plugins.gitversion.core.RuleContext;
import org.unbrokendome.gradle.plugins.gitversion.model.GitBranch;
package org.unbrokendome.gradle.plugins.gitversion.internal;




public class BranchNameRule extends AbstractSimpleRule {

    private final String branchName;


    BranchNameRule(String branchName, Action<RuleContext> action) {
        super(action);
        this.branchName = branchName;
    }


    @Nonnull
    @Override
    protected MatchResult match(RuleEvaluationContext evaluationContext) {

// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/core/RuleContext.java
// public interface RuleContext {
// 
//     @Nonnull
//     MutableSemVersion getVersion();
// 
// 
//     default void setVersion(SemVersion version) {
//         getVersion().setFrom(version);
//     }
// 
// 
//     default void setVersion(String versionString) {
//         getVersion().setFrom(versionString);
//     }
// 
//     /**
//      * Gets the Gradle project.
//      *
//      * @return the Gradle {@link Project}
//      */
//     @Nonnull
//     Project getProject();
// 
//     /**
//      * Gets the Git repository.
//      *
//      * @return the {@link GitRepository}
//      */
//     @Nonnull
//     GitRepository getRepository();
// 
//     /**
//      * Gets the current HEAD commit.
//      *
//      * @return the current HEAD as a {@link GitCommit}, or {@code null} if the repository is empty
//      */
//     @Nullable
//     default GitCommit getHead() {
//         return getRepository().getHead();
//     }
// 
//     boolean isSkipOtherRules();
// 
//     void setSkipOtherRules(boolean skipOtherRules);
// 
//     @Nullable
//     default GitBranch getCurrentBranch() {
//         return getRepository().getCurrentBranch();
//     }
// 
//     /**
//      * Gets the <em>short</em> name of the current branch, i.e. the branch that the HEAD points to.
//      * Returns {@code null} if the repository is in "detached head" state.
//      *
//      * <p>The short branch name does not include the {@code refs/heads/} prefix.</p>
//      *
//      * @return the short name of the current branch
//      */
//     @Nullable
//     default String getBranchName() {
//         GitBranch branch = getCurrentBranch();
//         return branch != null ? branch.getShortName() : null;
//     }
// 
// 
//     @Nullable
//     default BranchPoint branchPoint() {
//         String masterBranch = Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + Constants.MASTER;
//         return branchPoint(masterBranch);
//     }
// 
// 
//     @Nullable
//     default BranchPoint branchPoint(String... otherBranchNames) {
//         return new GitOperations(getRepository()).branchPoint(otherBranchNames);
//     }
// 
// 
//     @Nullable
//     default BranchPoint branchPoint(Pattern otherBranchNamePattern) {
//         return new GitOperations(getRepository()).branchPoint(otherBranchNamePattern);
//     }
// 
// 
//     default int countCommitsSince(HasObjectId obj) {
//         return countCommitsSince(obj, false);
//     }
// 
// 
//     default int countCommitsSince(HasObjectId obj, boolean countMergeCommits) {
//         return new GitOperations(getRepository()).countCommitsSince(obj, countMergeCommits);
//     }
// 
// 
//     @Nullable
//     default TaggedCommit findLatestTag(Pattern tagNamePattern, boolean includeMerges) {
//         return new GitOperations(getRepository()).findLatestTag(tagNamePattern, includeMerges);
//     }
// 
// 
//     @Nullable
//     default TaggedCommit findLatestTag(Pattern tagNamePattern) {
//         return findLatestTag(tagNamePattern, true);
//     }
// }
// 
// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/model/GitBranch.java
// public interface GitBranch {
// 
//     @Nonnull
//     String getShortName();
// 
//     @Nonnull
//     String getFullName();
// 
//     @Nonnull
//     GitCommit getHead();
// }


// Path: src/main/java/org/unbrokendome/gradle/plugins/gitversion/internal/BranchNameRule.java
import javax.annotation.Nonnull;
import org.gradle.api.Action;
import org.unbrokendome.gradle.plugins.gitversion.core.RuleContext;
import org.unbrokendome.gradle.plugins.gitversion.model.GitBranch;

package org.unbrokendome.gradle.plugins.gitversion.internal;




public class BranchNameRule extends AbstractSimpleRule {

    private final String branchName;


    BranchNameRule(String branchName, Action<RuleContext> action) {
        super(action);
        this.branchName = branchName;
    }


    @Nonnull
    @Override
    protected MatchResult match(RuleEvaluationContext evaluationContext) {

        GitBranch currentBranch = evaluationContext.getRepository().getCurrentBranch();