Sha256: 7d445bd6ee52625952e99252edfa20f095ffaee872d4c8f1240ffd48a53502dd

Contents?: true

Size: 827 Bytes

Versions: 10

Compression:

Stored size: 827 Bytes

Contents

class Git
  def self.show(rev)
    `git show #{rev.strip} -w`
  end

  def self.log(rev1, rev2)
    `git log #{rev1}..#{rev2}`.strip
  end

  def self.branch_commits(treeish)
    args = Git.branch_heads - [Git.branch_head(treeish)]
    args.map! {|tree| "^#{tree}"}
    args << treeish
    `git rev-list #{args.join(' ')}`.to_a.map{|commit| commit.chomp}
  end

  def self.branch_heads
    `git rev-parse --branches`.to_a.map{|head| head.chomp}
  end

  def self.branch_head(treeish)
    `git rev-parse #{treeish}`.strip
  end

  def self.repo_name
    git_prefix = `git config hooks.emailprefix`.strip
    return git_prefix unless git_prefix.empty?
    dir_name = `pwd`.chomp.split("/").last.gsub(/\.git$/, '')
    return "#{dir_name}"
  end

  def self.mailing_list_address
    `git config hooks.mailinglist`.strip
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
git-commit-notifier-0.8.0 lib/git.rb
git-commit-notifier-0.7.2 lib/git.rb
git-commit-notifier-0.7.1 lib/git.rb
git-commit-notifier-0.7.0 lib/git.rb
git-commit-notifier-0.6.2 lib/git.rb
git-commit-notifier-0.6.1 lib/git.rb
git-commit-notifier-0.5.0 lib/git.rb
git-commit-notifier-0.3.0 lib/git.rb
git-commit-notifier-0.2.0 lib/git.rb
git-commit-notifier-0.1.0 lib/git.rb