Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tag category enablement #541

Merged
merged 1 commit into from Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
Expand Up @@ -787,10 +787,14 @@ protected List<Action> retrieveActions(@NonNull SCMHead head, @CheckForNull SCMH
*/
@Override
protected boolean isCategoryEnabled(@NonNull SCMHeadCategory category) {
if (category instanceof TagSCMHeadCategory) {
return new GitSCMSourceContext<>(null, SCMHeadObserver.none()).withTraits(getTraits()).wantTags();
if (super.isCategoryEnabled(category)) {
for (SCMSourceTrait trait : getTraits()) {
if (trait.isCategoryEnabled(category)) {
return true;
}
}
}
return super.isCategoryEnabled(category);
return false;
}

protected String getCacheEntry() {
Expand Down
Expand Up @@ -44,6 +44,7 @@
import jenkins.scm.api.trait.SCMSourceRequest;
import jenkins.scm.api.trait.SCMSourceTrait;
import jenkins.scm.api.trait.SCMSourceTraitDescriptor;
import jenkins.scm.impl.TagSCMHeadCategory;
import jenkins.scm.impl.trait.Discovery;
import org.kohsuke.stapler.DataBoundConstructor;

Expand Down Expand Up @@ -75,7 +76,7 @@ protected void decorateContext(SCMSourceContext<?, ?> context) {
*/
@Override
public boolean includeCategory(@NonNull SCMHeadCategory category) {
return category.isUncategorized();
return category instanceof TagSCMHeadCategory;
}

/**
Expand Down