function getRepoTags()

in gulpfile.js [321:344]


  function getRepoTags(repoName) {
    var dfd = Q.defer();
    // Get the tags for the repo
    var gitCommand = 'git ls-remote --tags "https://gitbox.apache.org/repos/asf/' + repoName + '.git"';
    exec(gitCommand, function(err, stdout, stderr) {
      // Abort if tags not found or something bad happened with the git ls-remote command
      if (err || stderr) {
        def.reject(err || stderr);
      }
      // Lines from ls-remote command look like [COMMIT_HASH]\trefs/tags/[TAG_NAME]
      var lines = stdout.split('\n');
      for (var i = 0; i < lines.length; i++) {
        if (lines[i] && lines[i].trim().length > 0) {
          // console.log("Processing line[", i, "] : ", lines[i]);
          lines[i] = lines[i].split('\t');
          if (lines[i][1]) {
            lines[i][1] = lines[i][1].replace('refs/tags/v', '');
          }
        }
      }
      dfd.resolve(lines);
    });
    return dfd.promise;
  }