Sha256: e75094dbd285ba8bf75a9c75b76227a18b7b51799344dc33bb17401aaa254536
Contents?: true
Size: 652 Bytes
Versions: 18
Compression:
Stored size: 652 Bytes
Contents
# frozen_string_literal: true require "open3" require "pathname" module Datadog module CI module Utils module Git def self.valid_commit_sha?(sha) return false if sha.nil? sha.match?(/\A[0-9a-f]{40}\Z/) || sha.match?(/\A[0-9a-f]{64}\Z/) end def self.normalize_ref(ref) return nil if ref.nil? refs = %r{^refs/(heads/)?} origin = %r{^origin/} tags = %r{^tags/} ref.gsub(refs, "").gsub(origin, "").gsub(tags, "") end def self.is_git_tag?(ref) !ref.nil? && ref.include?("tags/") end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems