summaryrefslogtreecommitdiff
path: root/app/helpers/git_helper.rb
blob: f7c511cdc474dd23e5fe2984fbe050b6b827073e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

module GitHelper
  def strip_signature(text)
    text = text.gsub(/-----BEGIN PGP SIGNATURE-----(.*)-----END PGP SIGNATURE-----/m, "")
    text = text.gsub(/-----BEGIN PGP MESSAGE-----(.*)-----END PGP MESSAGE-----/m, "")
    text.gsub(/-----BEGIN SIGNED MESSAGE-----(.*)-----END SIGNED MESSAGE-----/m, "")
  end

  def short_sha(text)
    Commit.truncate_sha(text)
  end
end