Merge "Allow using asterisk '*' in branches parameter for git-mirror jobs"
diff --git a/git-mirror-pipeline.groovy b/git-mirror-pipeline.groovy
index 8bfe467..8766678 100644
--- a/git-mirror-pipeline.groovy
+++ b/git-mirror-pipeline.groovy
@@ -4,7 +4,11 @@
   timeout(time: 12, unit: 'HOURS') {
     node() {
       try{
-        def branches = BRANCHES.tokenize(',')
+        if (BRANCHES.equals("*") || BRANCHES.contains('*')) {
+          branches = git.getBranchesForGitRepo(SOURCE_URL, BRANCHES)
+        } else {
+          branches = BRANCHES.tokenize(',')
+        }
         def pollBranches = []
         for (i=0; i < branches.size(); i++) {
             pollBranches.add([name:branches[i]])