module GitHelpers

Public Instance Methods

heads(commit) click to toggle source
# File lib/zitgit/helpers/git.rb, line 2
def heads(commit)
  repo = Grit::Repo.new('.')
  repo.heads.select{|head| head.commit.id == commit.id}
end
is_head_ref(ref) click to toggle source
# File lib/zitgit/helpers/git.rb, line 29
def is_head_ref(ref)
  ref.name.split('/').index('HEAD')
end
is_image(diff) click to toggle source
# File lib/zitgit/helpers/git.rb, line 33
def is_image(diff)
  image_exts = ['.jpg', '.jpeg', '.png', '.gif']
  image_exts.include?(File.extname(diff.a_path)) or image_exts.include?(File.extname(diff.b_path))
end
large_commit?(commit) click to toggle source
# File lib/zitgit/helpers/git.rb, line 21
def large_commit?(commit)
  commit.diffs.count > 20
end
large_diff?(diff) click to toggle source
# File lib/zitgit/helpers/git.rb, line 25
def large_diff?(diff)
  diff.diff.lines.count > 200
end
merge_commit?(commit) click to toggle source
# File lib/zitgit/helpers/git.rb, line 17
def merge_commit?(commit)
  commit.parents.count > 1
end
remotes(commit) click to toggle source
# File lib/zitgit/helpers/git.rb, line 7
def remotes(commit)
  repo = Grit::Repo.new('.')
  repo.remotes.select{|head| head.commit.id == commit.id}
end
tags(commit) click to toggle source
# File lib/zitgit/helpers/git.rb, line 12
def tags(commit)
  repo = Grit::Repo.new('.')
  repo.tags.select{|head| head.commit.id == commit.id}
end