module Bringit

Bringit::Commit is a wrapper around native Rugged::Commit object

Bringit::CommitStats counts the additions, deletions, and total changes in a commit.

Bringit::Diff is a wrapper around native Rugged::Diff object

Constants

BLANK_SHA
BRANCH_REF_PREFIX
TAG_REF_PREFIX
VERSION

Public Class Methods

blank_ref?(ref) click to toggle source
# File lib/bringit.rb, line 88
def blank_ref?(ref)
  ref == BLANK_SHA
end
branch_name(ref) click to toggle source
# File lib/bringit.rb, line 52
def branch_name(ref)
  ref = ref.to_s
  if self.branch_ref?(ref)
    self.ref_name(ref)
  else
    nil
  end
end
branch_ref?(ref) click to toggle source
# File lib/bringit.rb, line 84
def branch_ref?(ref)
  ref.start_with?(BRANCH_REF_PREFIX)
end
committer_hash(email:, name:) click to toggle source
# File lib/bringit.rb, line 61
def committer_hash(email:, name:)
  return if email.nil? || name.nil?

  {
    email: email,
    name: name,
    time: Time.now
  }
end
ref_name(ref) click to toggle source
# File lib/bringit.rb, line 48
def ref_name(ref)
  ref.sub(/\Arefs\/(tags|heads)\//, '')
end
tag_name(ref) click to toggle source
# File lib/bringit.rb, line 71
def tag_name(ref)
  ref = ref.to_s
  if self.tag_ref?(ref)
    self.ref_name(ref)
  else
    nil
  end
end
tag_ref?(ref) click to toggle source
# File lib/bringit.rb, line 80
def tag_ref?(ref)
  ref.start_with?(TAG_REF_PREFIX)
end
version() click to toggle source
# File lib/bringit.rb, line 92
def version
  Bringit::VersionInfo.parse(Bringit::Popen.popen(%W(git --version)).first)
end