Skip to content

Commit

Permalink
Merge pull request #205 from pauxus/21952-tags-with-slashes
Browse files Browse the repository at this point in the history
[JENKINS-21952] Resolve tags with slashes
  • Loading branch information
MarkEWaite committed Mar 15, 2014
2 parents e6b41fb + 4ad4791 commit 7b89557
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java
Expand Up @@ -71,14 +71,8 @@ public Collection<Revision> getCandidateRevisions(boolean isPollCall, String sin

Collection<Revision> revisions = new ArrayList<Revision>();

// if it doesn't contain '/' then it could be either a tag or an unqualified branch
// if it doesn't contain '/' then it could be an unqualified branch
if (!singleBranch.contains("/")) {
// the 'branch' could actually be a tag:
Set<String> tags = git.getTagNames(singleBranch);
if(tags.size() != 0) {
verbose(listener, "{0} is a tag");
return getHeadRevision(isPollCall, singleBranch, git, listener, data);
}

// <tt>BRANCH</tt> is recognized as a shorthand of <tt>*/BRANCH</tt>
// so check all remotes to fully qualify this branch spec
Expand Down Expand Up @@ -112,6 +106,15 @@ public Collection<Revision> getCandidateRevisions(boolean isPollCall, String sin
}
}

if (revisions.isEmpty()) {
// the 'branch' could actually be a non branch reference (for example a tag or a gerrit change)

revisions = getHeadRevision(isPollCall, singleBranch, git, listener, data);
if (!revisions.isEmpty()) {
verbose(listener, "{0} seems to be a non-branch reference (tag?)");
}
}

return revisions;
}

Expand Down

0 comments on commit 7b89557

Please sign in to comment.