Skip to content
Permalink
Browse files
[JENKINS-21952] Resolve tags with slashes
If no revisions are found, try to use the branch as explicit reference.
This could be a tag rel/my-tags or any other explicit reference like a
gerrit changeset (refs/changes/xx/yy/z).
  • Loading branch information
pauxus committed Feb 27, 2014
1 parent 03d36a8 commit c7dae80b85c19acec2e52783cdc8335681d816e5
Showing 1 changed file with 10 additions and 7 deletions.
@@ -70,14 +70,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
@@ -111,6 +105,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.addAll(getHeadRevision(isPollCall, singleBranch, git, listener, data));
if (!revisions.isEmpty()) {
verbose(listener, "{0} seems to be a non-branch reference (tag?)");
}
}

return revisions;
}

0 comments on commit c7dae80

Please sign in to comment.