diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 8a26fb7..7cfd20f 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -34,11 +34,19 @@ ArrayList gettaglist(String workingSetRootPath) { return taglist } -ArrayList getremotetaglist(String repositoryURL) { +LinkedHashMap> getremoteshatagmap(String repositoryURL) { ArrayList taglist = new ArrayList() - def tagliststring = clh.getCommandOutput("git ls-remote --tags --sort=-version:refname ${repositoryURL}") - taglist = tagliststring.split('\\n') - return taglist + def shatagliststring = clh.getCommandOutput("git ls-remote --tags --sort=-version:refname ${repositoryURL}") + def shataglist = tagliststring.split('\\n') + + LinkedHashMap> shatagmap = new LinkedHashMap>() + for (shatag in shataglist) { + def shatagfields = shatag.split(' ') + def sha = shatagfields[0].trim() + def tag = shatagfields[1].trim() + shatagmap[sha].add(tag) + } + return shatagmap } @NonCPS